Skip to main content

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.

PropertyTypeDescription
sort_keynumberA key which will determine the category's order relative to other categories (sorted low to high)
iconstringIcon 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_searchbooleanHiding 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_bottombooleanPinning a category to the bottom puts it below all other categories, including object command categories.
setting_max_options_countnumberLimit on the amount of options that can be shown in the category. Set to null for "no limit."
slash_filter_keywordstringLets 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_enabledbooleanMakes this a "major category," allowing the user to filter from this category via a tab below the input.
search_tab_namestringCustom category name to be shown in the tab below the input (defaults to category name).
search_tab_instructionstringCustom placeholder to be shown when the user filters for this major category (e.g., "Type to search").
track_recentsbooleanInclude commands from this category in the Recents section. Defaults to true.