Command: Async results
Set shouldFilter={false} and render the results you fetch. <CommandLoading /> waits 150 ms before it appears and then stays at least 300 ms, so fast responses never flash a spinner. Try both latencies.
This adds the example as components/examples/command/async.tsx, together with the Command component and the HextaUI theme tokens it needs.
pnpm dlx shadcn@latest add https://hextaui.com/r/command-async.jsonTo add only the component, follow the Command installation.
Props in this example
The Command props this example sets, from the API reference.
| Prop | Type | Default |
|---|---|---|
highlightHighlights the matched letters in each item and dims the rest. | boolean | false |
shouldFilterSet to false to filter and sort the items yourself, for example when results come from a server. | boolean | true |
| Prop | Type | Default |
|---|---|---|
valueControlled search text. | string | – |
onValueChange | (search: string) => void | – |
placeholder | string | – |
| Prop | Type | Default |
|---|---|---|
loading | boolean | true |
| Prop | Type | Default |
|---|---|---|
heading | ReactNode | – |
Every prop is in the Command API reference.
See them all, with keyboard support and accessibility notes, on the Command page.
- ButtonButtons in every variant and size, with a built-in loading, success and error flow that skips the spinner for fast requests.
- HotkeyParse, label, announce and match keyboard shortcuts, with ⌘ on Apple platforms and Ctrl everywhere else.
- MotionThe easing curves, durations and reduced-motion check every component animates with, plus hooks for size morphs and sliding highlights.
- SpinnerA loading indicator with Apple-style ticks or a breathing ring that can wait before showing and stay long enough not to flicker.
- Alert dialogA confirmation dialog for destructive or important actions that waits for async work, and becomes a bottom sheet on phones.
- Context menuA menu of actions on right click or long press, with submenus, checkbox and radio items, and hold feedback on touch.