Preview
Use the tabs to compare the temporary Basic palette, inset Layer dialog, and inline Preview layout.
Meeting recap
Turn these meeting notes into a short recap. Start with the decision. Then list action items with an owner and due date. Keep unresolved questions separate. Do not invent details.
Design guidance
Use Command to find one action or saved prompt in a known set. Keep search text separate from the highlighted row. Arrow keys and pointer movement update the highlighted record; they do not run the action. Give each item an onClick callback that acts on that exact record. Base UI calls the same item callback for Enter.
The caller owns records, filtering, action results, and any dialog state. Insert exact prompt text into the current draft. Use an inline picker when search belongs to the current task. Use a dialog for temporary search. Keep disabled actions visible only when their context matters; disabled rows cannot be highlighted or activated.
Command.Shortcut displays a hint. It does not install a keyboard handler. Add a scoped handler when the caller wants a key to run an action.
Installation
The examples also compose Button, Kbd, Tabs, and Textarea. Add those components when copying their examples.
Basic usage
Command.Input composes Autocomplete behavior with the canonical InputGroup control. The item callback receives the record directly, so two records can have the same title. For caller filtering, pass the filtered records as items with filter={null}, or provide filteredItems while preserving the original flat or grouped shape.
Structures
For a plain palette, omit Layout, Panel, and Preview. Use Group and GroupLabel only when the list needs categories. Dialog adds its focus lifecycle around the same search/list composition.
Examples
Basic dialog
Use Basic for a short list of prompts. The dialog has a hidden title, returns focus to its trigger, and inserts the chosen prompt into an editable draft.
Layer dialog
Use Layer when the palette needs an inset surface. The example opens both the 600px single-column list and the 880px split view with a 320px list panel.
Preview detail
Use Preview when the highlighted prompt needs a readable detail pane. Highlighting changes the preview. The explicit Use prompt button inserts that record into the editable draft.
Meeting recap
Turn these meeting notes into a short recap. Start with the decision. Then list action items with an owner and due date. Keep unresolved questions separate. Do not invent details.
Inline picker
Use an inline picker when search is part of the current task. Item activation inserts the exact record into the editable draft.
Groups and shortcut hints
Group related prompts and actions. Shortcut hints are visual only; the caller owns keyboard handling.
Scrollable list
Keep a long collection in its own scroll region so search stays visible.
No results
The collection has records, but the current query filters them all out. Edit the search to restore matching prompts.
Empty collection
Use this state when the caller has no prompt records yet. It differs from a query with no matches.
Disabled action
Show a disabled action when its context matters. It remains visible, is skipped by keyboard navigation, and cannot run.
API reference
Command.Root preserves Base UI's flat and grouped item inference. It renders no DOM. value and defaultValue are query strings, not selected record IDs. Root defaults are inline={true}, open={true}, autoHighlight="always", keepHighlight={true}, and submitOnItemClick={false}. Explicit values override these defaults.
Command.Item keeps Base UI item behavior and render/ref/state class support. Put the action on its onClick; do not infer a record from its display label. Arrow and pointer highlight events do not run the action. Native Enter uses the same item callback.
| Prop | Type | Default | Description |
|---|---|---|---|
Command.Inline | div props + ref | variant=basic | Inline surface. Basic defaults to a 640px maximum. Layer with one column is 600px; Layer containing Command.Layout split and Preview are 880px. The compact inline example is 384px. Native div props, ref, render, and state className behavior are preserved. |
Command.Popup | Dialog.Popup props + ref | variant=basic | Dialog surface. Command.Layout split owns the two-column structure and expands Layer to 880px. Width clamps to the viewport with 16px side space. |
Command.Layout | div props + ref; split?: boolean | split=false | Horizontal layout for a list panel and optional preview. At 640px and below, split content stacks in reading order. |
Command.Panel | div props + ref | Search, list, and footer column. Layer borders Content so its footer stays on the outer surface. | |
Command.Content | div props + ref | Search and list region. Layer gives it the inset card boundary. | |
Command.Preview | section props + ref | Caller-owned highlighted-record detail. It does not execute actions. | |
Command.ItemLabel | span props + ref | Flexible label slot. Prevents trailing shortcuts from changing title sizing. | |
Command.ItemDescription | span props + ref | Optional secondary text inside ItemLabel. | |
Command.Shortcut | div props + ref | Trailing keyboard hint slot. It does not install a key handler. |
| Prop | Type | Default | Description |
|---|---|---|---|
Command.Root | Autocomplete.Root<Item> | inline=true; open=true; autoHighlight=always; keepHighlight=true; submitOnItemClick=false | Owns query, filtering, keyboard navigation, and highlight. Retains flat and grouped generic inference. value/defaultValue are query strings. |
Command.Input | Autocomplete.Input props + HTMLInputElement ref | canonical InputGroup control, compact row sizing | One visible Autocomplete search input. The shared InputGroup owns the focus boundary around the input and its addons. Caller className, ref, render, and state className are preserved. |
Command.Search | div props + ref | Composes InputGroup.Root. Place caller-owned icons in InputGroup.Addon beside Command.Input; the entire group shares one focus boundary. | |
Command.List / Group / GroupLabel / Collection | Base UI Autocomplete parts | Scrollable results, optional groups, labels, and flat or grouped item rendering. | |
Command.Item | Autocomplete.Item props + ref | Activates the exact record through onClick, including native Enter. Disabled items stay visible and cannot highlight or activate. | |
Command.Empty / Status | Base UI Autocomplete parts | Empty only appears when the current result count is zero. Status exposes announcements. | |
Command.Separator | canonical Separator props + ref | Uses the shared Separator owner and styling. | |
Command.Footer | footer props + ref | Shaded footer row. The caller owns its content and actions. | |
Command.Dialog / Trigger / Portal / Backdrop / Viewport / Title / Description / Close | Dialog parts | Canonical dialog lifecycle and accessible naming. Add a visually hidden Title when the design has no visible heading. |
| Prop | Type | Default | Description |
|---|---|---|---|
items | readonly Item[] | readonly Group<Item>[] | Records or grouped records shown by Autocomplete. Base UI generic inference is retained. | |
filteredItems | readonly Item[] | readonly Group<Item>[] | Externally filtered records with the same flat or grouped shape as items. | |
filter | Autocomplete filter | null | Base UI filter | Use null when items are already filtered by the caller. |
value / defaultValue | string | Controlled or initial uncontrolled search query. These values are never selected item IDs. | |
onValueChange | (query, details) => void | Observe query changes. Ignore item-press when maintaining caller search state. | |
onItemHighlighted | (item | undefined, details) => void | Updates preview from arrow or pointer movement. It does not activate the record. | |
itemToStringValue | (item) => string | Returns the display/search text for a record. Duplicate strings are allowed when keys and callbacks use record identity. | |
inline / open | boolean | true / true | The list is open inline inside the caller's surface by default. |
autoHighlight / keepHighlight | boolean | 'always' / boolean | always / true | Base UI highlight behavior. Disabled records remain visible and are skipped. |
submitOnItemClick | boolean | false | Command activation does not submit an owning outer form. |