Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated keys for command bar customization. #10152

Merged
merged 3 commits into from
Mar 14, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 35 additions & 7 deletions docs/declarative-customization/view-commandbar-formatting.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
title: Command bar customization syntax reference
description: Command bar customization syntax reference
ms.date: 08/12/2022
ms.date: 03/14/2025
ms.localizationpriority: high
---

Expand All @@ -10,12 +10,15 @@ ms.localizationpriority: high
Command bar customization helps personalize a list to suit specific requirements. The JSON based feature allows basic changes to the command bar, including modification of icon and/or text, hiding existing options or repositioning commands.

## commandBarProps

Properties for Command bar customization. Valid in all types of layouts.

## commands
Array of JSON objects to specify the commands for customization.

An array of JSON objects is used to specify the commands for customization.

## key

Mandatory property to uniquely identify a command in the Command bar. Valid keys include:

```javascript
Expand Down Expand Up @@ -86,23 +89,42 @@ Mandatory property to uniquely identify a command in the Command bar. Valid keys
'manageForms'
```

## 🚀 Recent updates to `commandBarCustomization` Keys

> [NOTE!]
> Some keys in the `commandBarCustomization` schema have been updated. To ensure your custom formatter works correctly, update your existing JSON with these new keys.
>
> | Original Key | Current Key |
> |--------------|-------------|
> | `new` | `newComposite` |
> | `upload` | `uploadCommand` |
> | `sync` | `syncCommand` |
> | `addShortcut`| `addShortcutToOneDriveCommand` |
> | `pinToQuickAccess` | `PinToQuickAccessCommand` |

## hide

An optional property that specifies the condition to hide a particular command. The value of this property can either be a boolean, string or an Expression object. `false` is the default behavior (meaning the command is visible). `true` means that the command will be hidden.

## text
An optional property that specifies the text to be displayed as the name of the command. The value of this property can either be a string or an Expression object. If the value is not provided then the default name of the command will be shown.

An optional property that specifies the text to be displayed as the name of the command. The value of this property can either be a string or an Expression object. If the value is not provided, then the default name of the command will be shown.

## title
An optional property that specifies the tooltip text to be displayed in the command. The value of this property can either be a string or an Expression object. If the value is not provided then the default tooltip of the command will be shown.

An optional property that specifies the tooltip text to be displayed in the command. The value of this property can either be a string or an Expression object. If the value is not provided, then the default tooltip of the command will be shown.

## iconName
An optional property that specifies the [Fluent UI](https://developer.microsoft.com/fluentui#/) icon to be displayed in the command. The value of this property can either be a string or an Expression object. If the value is not provided then the default icon of the command will be shown.

An optional property that specifies the [Fluent UI](https://developer.microsoft.com/fluentui#/) icon to be displayed in the command. The value of this property can either be a string or an Expression object. If the value is not provided, then the default icon of the command will be shown.

## primary

An optional property that specifies the condition to apply primary button styling to a command. The value of this property can either be a boolean, string or an Expression object. `false` is the default behavior (meaning the default style will be applied). `true` means the primary button styling will be applied to the command only if the command is placed at the 0th position in the command bar.

The following example shows a sample Command bar formatting JSON to do the following:
- Hide the 'New' command,.

- Hide the 'New' command.
- Update the text and icon of 'Edit in grid view' command and add primary button styling to it.
- Remove the icon from 'Share' command and update the tooltip text of it.

Expand Down Expand Up @@ -131,17 +153,20 @@ The following example shows a sample Command bar formatting JSON to do the follo
```

## position

An optional property that specifies the position where the command will be placed in the command bar. The value of this property can either be a number, string or an Expression object. If the value is not provided then the command will be placed in it's default position. This property follows zero-based indexing.

## sectionType

An optional property that specifies the section where the customized command will be placed in the command bar. The following strings are valid values for this property:

- Primary
- Overflow

The following example shows a sample Command bar formatting JSON to do the following:
- Puts the 'New' command at the third position in the primary section of the Command bar.
- Puts the 'Share' command at the second position in the overflow menu of the Command bar.
- Puts the 'Alert me' command at the fourth position in the primary section of theCommand bar.
- Puts the 'Alert me' command at the fourth position in the primary section of the Command bar.

```JSON
{
Expand All @@ -167,12 +192,15 @@ The following example shows a sample Command bar formatting JSON to do the follo
```

## selectionModes

An optional property that specifies the selection modes in which the command customization will be applied. If the value is not provided then the customization will be applied in all the selection modes in which the command is available. The value of this property can be array of strings where the following strings are allowed:

- NoSelection
- SingleSelection
- MultiSelection

The following example shows a sample Command bar formatting JSON to do the following:

- Update the text of 'Share' command if the selected item has 'NumberField' column value 3
- Update the text of 'Delete' command only if multiple items are selected.

Expand Down