You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Add a "primary" option for ListView Command Set commands (primary button styling in the list command bar)
#11088
Allow a ListView Command Set command to be rendered as a primary (accent) button in the list/library command bar — the same visual style the out-of-the-box New command has — via a built-in primary property on the command, both in the manifest and at runtime.
Problem
Many business solutions replace or extend the default list experience with a custom command set: "Create request", "Submit for approval", "Start process", etc. Functionally this custom command is the main action of the list, but today it always renders as a regular (secondary) button, so visually it looks less important than OOTB commands such as New or Edit in grid view. Users don't notice the custom action, and there is no supported way for the extension itself to say "this command is the primary one".
The Command class in @microsoft/sp-listview-extensibility currently exposes only id, title, iconImageUrl, ariaLabel, visible and disabled — nothing that controls the button's appearance.
Current workaround and why it is not enough
View command bar formatting (commandBarProps.commands[].primary) can target an SPFx command via the static key SpfxCustomActionNavigationCommand_<extensionId><commandName>, but:
it is a per-view configuration — it has to be applied (and maintained) on every view of every list where the extension is deployed, instead of shipping with the extension itself;
it only applies when the command is at position 0 of the command bar;
it is static JSON — the extension cannot change it at runtime (e.g. make the command primary only when nothing is selected, or depending on user permissions), while visible/disabled already work that way;
it couples the view formatting to the extension's GUID and command name, which is fragile across environments.
Proposal
Manifest — add an optional primary flag to a command definition:
Runtime — add primary?: boolean to the Command class, so it can be toggled in onInit / onListViewUpdated (or via onGetState / setState, in line with the direction discussed in The Future of Command Set Extensions #7375) exactly like visible and disabled are today:
Rendering — SharePoint renders such a command with its primary button style (as the OOTB New button). If the command bar already has a primary command, SharePoint stays in control: e.g. only the first primary command keeps the accent style, or the custom primary command replaces the default one when New is hidden. Overflow behavior stays unchanged.
The flag is purely additive and defaults to false, so existing extensions are unaffected.
Benefits
The main business action of a list becomes visually discoverable without custom view formatting on every view.
Appearance is controlled where the behavior already is — in the extension code — and can react to selection/permissions at runtime.
Consistent with Fluent UI / SharePoint visual language instead of the various hacks (CSS injection, custom toolbars) solution builders use today.
Related: #7375 ("The Future of Command Set Extensions") — several comments there ask for control over the order/appearance of custom commands.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Summary
Allow a ListView Command Set command to be rendered as a primary (accent) button in the list/library command bar — the same visual style the out-of-the-box New command has — via a built-in
primaryproperty on the command, both in the manifest and at runtime.Problem
Many business solutions replace or extend the default list experience with a custom command set: "Create request", "Submit for approval", "Start process", etc. Functionally this custom command is the main action of the list, but today it always renders as a regular (secondary) button, so visually it looks less important than OOTB commands such as New or Edit in grid view. Users don't notice the custom action, and there is no supported way for the extension itself to say "this command is the primary one".
The
Commandclass in@microsoft/sp-listview-extensibilitycurrently exposes onlyid,title,iconImageUrl,ariaLabel,visibleanddisabled— nothing that controls the button's appearance.Current workaround and why it is not enough
View command bar formatting (
commandBarProps.commands[].primary) can target an SPFx command via the static keySpfxCustomActionNavigationCommand_<extensionId><commandName>, but:visible/disabledalready work that way;Proposal
primaryflag to a command definition:primary?: booleanto theCommandclass, so it can be toggled inonInit/onListViewUpdated(or viaonGetState/setState, in line with the direction discussed in The Future of Command Set Extensions #7375) exactly likevisibleanddisabledare today:The flag is purely additive and defaults to
false, so existing extensions are unaffected.Benefits
Related: #7375 ("The Future of Command Set Extensions") — several comments there ask for control over the order/appearance of custom commands.
All reactions