Skip to main content

Command

A search-first menu of actions and places, opened from the keyboard.

Left out of Multi-brand Command suits expert users who jump anywhere by typing, not people who visit now and then. Multi-brand's customers return now and then, and most visits last a few minutes. Use instead: Navigation menu, Dropdown menu

See it live​

Start Storybook to see it live: npm run storybook

When to use it​

  • Use it when: Expert users who want to jump anywhere or run any action by typing.
  • Not when: The only way to reach an action, or people who visit now and then.

Instead:

Words​

  • Shared structure: object, state, next step.
  • Brand tone lives in headlines and marketing copy, not in errors.
  • Errors and confirmations read the same in every brand.
  • Use: Get started, Plan, Order. Avoid: Brand-specific words in errors, Jargon.

The labels components use, from the voice tokens:

  • content.action.commit: Save
  • content.action.cancel: Cancel
  • content.action.destroy: Remove
  • content.action.retry: Try again
  • content.action.empty-action: Get started

See Voice and tone for the whole voice.

Accessibility and keyboard​

KeyboardWhat happensNot
undefinedA shortcut opens it; arrows move; Enter runs; Escape closes.undefined

Test before you ship:

  • Results are a list; the active result is announced. undefined

Use it in code​

npx open-ds add command

The component reads only component keys and semantic tokens, so it follows the brand and mode on <html>.

Tokens it reads​

Command reads 38 tokens of its own, each an alias of a semantic token. Each row is one part: its own token, the semantic it aliases, and the value it ends at. Change a semantic and every component that reads it follows; override one of Command's tokens to change Command alone.

Changes with theme

Multi-brand decides what changes when you switch theme. Here a switch changes colors, type and shape, so the marked rows differ between its brands and between light and dark; everything else holds steady.

PartIts token and the semantic it aliasesValue
Command
Corner
Changes with theme
component.command.radiusradius.controlvar(--command-radius)Aster Lightradius.4:0.25remAster Darkradius.4:0.25remBirch Lightradius.12:0.75remBirch Darkradius.12:0.75remCoral Lightradius.999:9999pxCoral Darkradius.999:9999px
Fill
Changes with theme
component.command.backgroundcolor.surface.raisedvar(--command-background)Aster Lightslate-deep.light.0:#FFFFFFAster Darkslate-deep.dark.100:#1E293BBirch Lightslate-deep.light.0:#FFFFFFBirch Darkslate-deep.dark.100:#1E293BCoral Lightslate-deep.light.0:#FFFFFFCoral Darkslate-deep.dark.100:#1E293B
Text
Changes with theme
component.command.labelcolor.text.primaryvar(--command-label)Aster Lightslate-deep.light.900:#0F172AAster Darkslate-deep.dark.900:#F8FAFCBirch Lightslate-deep.light.900:#0F172ABirch Darkslate-deep.dark.900:#F8FAFCCoral Lightslate-deep.light.900:#0F172ACoral Darkslate-deep.dark.900:#F8FAFC
Padding, left and rightcomponent.command.padding-xcomponent-spacing-map.x2var(--command-padding-x)space.8:0.5rem
Weightcomponent.command.font-weighttype.label.font-weightvar(--command-font-weight)font.weight.600:600
Label 2
Changes with theme
component.command.label-2color.text.mutedvar(--command-label-2)Aster Lightslate-deep.light.600:#4B5A6FAster Darkslate-deep.dark.400:#96A3B5Birch Lightslate-deep.light.600:#4B5A6FBirch Darkslate-deep.dark.400:#96A3B5Coral Lightslate-deep.light.600:#4B5A6FCoral Darkslate-deep.dark.400:#96A3B5
Padding, top and bottomcomponent.command.padding-ycomponent-spacing-map.x3var(--command-padding-y)space.20:1.25rem
Icon sizecomponent.command.icon-sizesize.iconvar(--command-icon-size)size.16:1rem
Disabled opacitycomponent.command.disabled-opacityopacity.disabledvar(--command-disabled-opacity)opacity.40:0.4
Input
Wrapper gapcomponent.command.input.wrapper.gapspace.gap.defaultvar(--command-input-wrapper-gap)space.12:0.75rem
Wrapper padding xcomponent.command.input.wrapper.padding-xcomponent-spacing-map.x3var(--command-input-wrapper-padding-x)space.20:1.25rem
Corner
Changes with theme
component.command.input.radiusradius.controlvar(--command-input-radius)Aster Lightradius.4:0.25remAster Darkradius.4:0.25remBirch Lightradius.12:0.75remBirch Darkradius.12:0.75remCoral Lightradius.999:9999pxCoral Darkradius.999:9999px
Padding, top and bottomcomponent.command.input.padding-ycomponent-spacing-map.x3var(--command-input-padding-y)space.20:1.25rem
Text sizecomponent.command.input.font-sizetype.body.font-sizevar(--command-input-font-size)font.size.16:1rem
Label placeholder
Changes with theme
component.command.input.label-placeholdercolor.text.mutedvar(--command-input-label-placeholder)Aster Lightslate-deep.light.600:#4B5A6FAster Darkslate-deep.dark.400:#96A3B5Birch Lightslate-deep.light.600:#4B5A6FBirch Darkslate-deep.dark.400:#96A3B5Coral Lightslate-deep.light.600:#4B5A6FCoral Darkslate-deep.dark.400:#96A3B5
Disabled opacity disabled
when disabled
component.command.input.disabled-opacity-disabledopacity.disabledvar(--command-input-disabled-opacity-disabled)opacity.40:0.4
Empty
Padding, top and bottomcomponent.command.empty.padding-ycomponent-spacing-map.x6var(--command-empty-padding-y)space.36:2.25rem
Text sizecomponent.command.empty.font-sizetype.body.font-sizevar(--command-empty-font-size)font.size.16:1rem
Group
Paddingcomponent.command.group.paddingcomponent-spacing-map.x1var(--command-group-padding)space.4:0.25rem
Text
Changes with theme
component.command.group.labelcolor.text.primaryvar(--command-group-label)Aster Lightslate-deep.light.900:#0F172AAster Darkslate-deep.dark.900:#F8FAFCBirch Lightslate-deep.light.900:#0F172ABirch Darkslate-deep.dark.900:#F8FAFCCoral Lightslate-deep.light.900:#0F172ACoral Darkslate-deep.dark.900:#F8FAFC
Padding, left and rightcomponent.command.group.padding-xcomponent-spacing-map.x2var(--command-group-padding-x)space.8:0.5rem
Padding, top and bottomcomponent.command.group.padding-ycomponent-spacing-map.x2var(--command-group-padding-y)space.8:0.5rem
Text sizecomponent.command.group.font-sizetype.caption.font-sizevar(--command-group-font-size)font.size.13:0.8125rem
Weightcomponent.command.group.font-weighttype.label.font-weightvar(--command-group-font-weight)font.weight.600:600
Label 2
Changes with theme
component.command.group.label-2color.text.mutedvar(--command-group-label-2)Aster Lightslate-deep.light.600:#4B5A6FAster Darkslate-deep.dark.400:#96A3B5Birch Lightslate-deep.light.600:#4B5A6FBirch Darkslate-deep.dark.400:#96A3B5Coral Lightslate-deep.light.600:#4B5A6FCoral Darkslate-deep.dark.400:#96A3B5
Separator
Fill
Changes with theme
component.command.separator.backgroundcolor.border.defaultvar(--command-separator-background)Aster Lightslate-deep.light.200:#E2E8F0Aster Darkslate-deep.dark.100:#1E293BBirch Lightslate-deep.light.200:#E2E8F0Birch Darkslate-deep.dark.100:#1E293BCoral Lightslate-deep.light.200:#E2E8F0Coral Darkslate-deep.dark.100:#1E293B
Item
Gapcomponent.command.item.gapspace.gap.defaultvar(--command-item-gap)space.12:0.75rem
Corner
Changes with theme
component.command.item.radiusradius.badgevar(--command-item-radius)Aster Lightradius.4:0.25remAster Darkradius.4:0.25remBirch Lightradius.999:9999pxBirch Darkradius.999:9999pxCoral Lightradius.999:9999pxCoral Darkradius.999:9999px
Padding, left and rightcomponent.command.item.padding-xcomponent-spacing-map.x2var(--command-item-padding-x)space.8:0.5rem
Padding, top and bottomcomponent.command.item.padding-ycomponent-spacing-map.x2var(--command-item-padding-y)space.8:0.5rem
Text sizecomponent.command.item.font-sizetype.body.font-sizevar(--command-item-font-size)font.size.16:1rem
Disabled opacity disabled
when disabled
component.command.item.disabled-opacity-disabledopacity.disabledvar(--command-item-disabled-opacity-disabled)opacity.40:0.4
Background selected
Changes with theme
when selected
component.command.item.background-selectedcolor.surface.sunkenvar(--command-item-background-selected)Aster Lightslate-deep.light.100:#F1F5F9Aster Darkslate-deep.dark.100:#1E293BBirch Lightslate-deep.light.100:#F1F5F9Birch Darkslate-deep.dark.100:#1E293BCoral Lightslate-deep.light.100:#F1F5F9Coral Darkslate-deep.dark.100:#1E293B
Label selected
Changes with theme
when selected
component.command.item.label-selectedcolor.text.primaryvar(--command-item-label-selected)Aster Lightslate-deep.light.900:#0F172AAster Darkslate-deep.dark.900:#F8FAFCBirch Lightslate-deep.light.900:#0F172ABirch Darkslate-deep.dark.900:#F8FAFCCoral Lightslate-deep.light.900:#0F172ACoral Darkslate-deep.dark.900:#F8FAFC
Icon sizecomponent.command.item.icon-sizesize.iconvar(--command-item-icon-size)size.16:1rem
Text
Changes with theme
component.command.item.labelcolor.text.mutedvar(--command-item-label)Aster Lightslate-deep.light.600:#4B5A6FAster Darkslate-deep.dark.400:#96A3B5Birch Lightslate-deep.light.600:#4B5A6FBirch Darkslate-deep.dark.400:#96A3B5Coral Lightslate-deep.light.600:#4B5A6FCoral Darkslate-deep.dark.400:#96A3B5
Shortcut
Text sizecomponent.command.shortcut.font-sizetype.caption.font-sizevar(--command-shortcut-font-size)font.size.13:0.8125rem
Text
Changes with theme
component.command.shortcut.labelcolor.text.mutedvar(--command-shortcut-label)Aster Lightslate-deep.light.600:#4B5A6FAster Darkslate-deep.dark.400:#96A3B5Birch Lightslate-deep.light.600:#4B5A6FBirch Darkslate-deep.dark.400:#96A3B5Coral Lightslate-deep.light.600:#4B5A6FCoral Darkslate-deep.dark.400:#96A3B5
From the system
Edge
Changes with theme
color.border.default
straight from the system, through --border
Aster Lightslate-deep.light.200 · #E2E8F0Aster Darkslate-deep.dark.100 · #1E293BBirch Lightslate-deep.light.200 · #E2E8F0Birch Darkslate-deep.dark.100 · #1E293BCoral Lightslate-deep.light.200 · #E2E8F0Coral Darkslate-deep.dark.100 · #1E293B