Zephora UI

Navigation

Command

Command palette: a filter input driving a keyboard-navigable listbox of grouped items, with an empty state and an optional modal dialog wrapper.

Import

import { Command, CommandInput, CommandList, CommandGroup, CommandItem, CommandEmpty, CommandDialog } from "@zephora/react";

Examples

Inline palette

Type to filter; ArrowUp/Down move the active item and Enter picks it.

No results.
Go home
Open settings
New file
Delete workspace

Picked: none

Command dialog

CommandDialog hosts the palette in a centered modal overlay.

API

Command props

PropTypeDefaultDescription
unstyledbooleanfalseHeadless mode — inherited by all parts.

CommandInput props

PropTypeDefaultDescription
…restOmit<InputHTMLAttributes<HTMLInputElement>, "value" | "onChange" | "size">Native input props (placeholder, autoFocus…). Value and onChange are managed by the Command root.

CommandItem props

PropTypeDefaultDescription
value *stringUnique value used for filtering, selection and identity.
keywordsstring[]Extra strings matched by the filter.
onSelect(value: string) => voidCalled when the item is picked (click or Enter).
disabledbooleanfalseDisables selection and keyboard navigation.
iconReactNodeLeading icon.
shortcutReactNodeTrailing keyboard shortcut hint.

CommandGroup props

PropTypeDefaultDescription
headingReactNodeOptional heading rendered above the group's items.

CommandDialog props

PropTypeDefaultDescription
openbooleanControlled open state.
defaultOpenbooleanfalseInitial open state when uncontrolled.
onOpenChange(open: boolean) => voidCalled when the open state changes.
aria-labelstring"Command palette"Accessible name of the dialog.

Keyboard

KeyAction
ArrowDown / ArrowUpMove the active item through matching results.
Home / EndJump to the first / last matching item.
EnterPicks the active item.
EscapeCloses the CommandDialog.