setCategoryConfig(category, config)
Configure a category.
Example
window.CommandBar.setCategoryConfig("Navigation", { search_tab_enabled: true });
Method parameters
category Required
string | number
The id
(or name) of the category. If you provide a name and that category doesn't exist, it will be created automatically.
config Required
object
The category configuration schema.
Property | Type | Description |
---|---|---|
sort_key | number | A key which will determine the category's order relative to other categories (sorted low to high) |
icon | string | Icon to be used for each command in this category. Can be a URL (absolute or relative), emoji character, or an SVG string (which must begin with <svg ) |
setting_hide_before_search | boolean | Hiding categories before search means that they will only show up during search but not in the default list when Spotlight is opened. |
setting_pin_to_bottom | boolean | Pinning a category to the bottom puts it below all other categories, including object command categories. |
setting_max_options_count | number | Limit on the amount of options that can be shown in the category. Set to null for "no limit." |
slash_filter_keyword | string | Lets users type /keyword to apply a slash filter on this category. If omitted, the category name is applied as a default. Set to '' to disable slash filters. |
search_tab_enabled | boolean | Makes this a "major category," allowing the user to filter from this category via a tab below the input. |
search_tab_name | string | Custom category name to be shown in the tab below the input (defaults to category name). |
search_tab_instruction | string | Custom placeholder to be shown when the user filters for this major category (e.g., "Type to search"). |
track_recents | boolean | Include commands from this category in the Recents section. Defaults to true. |