Skip to content
CraftDocs
GitHub
Home
Home
Changelog
What's New
Guide
Guide
Getting Started
Principles
Styling Components
Theme System
Foundations
All Tokens
Color
Elevation
Icons
Motion
Shape
Spacing
Typography
Libraries
Libraries
@xds/cli
@xds/core
Themes
Themes
Theme: daily
Default Theme
Theme: matcha
Neutral Theme
Components
Components
AppShell
AspectRatio
Avatar
Avatar
AvatarStatusDot
Badge
Banner
Breadcrumbs
BreadcrumbItem
Breadcrumbs
Button
Button
IconButton
ToggleButton
ToggleButtonGroup
Calendar
Card
Carousel
Chat
ChatComposer
ChatComposerDrawer
ChatComposerInput
ChatComposerTokenElement
ChatDictationButton
ChatLayout
ChatLayoutScrollButton
ChatMessage
ChatMessageBubble
ChatMessageList
ChatMessageMetadata
ChatSendButton
ChatSystemMessage
ChatTokenizedText
ChatToolCalls
Checkbox
CheckboxInput
CheckboxList
CheckboxListItem
ClickableCard
Code
CodeBlock
Collapsible
Collapsible
CollapsibleGroup
useXDSCollapsible
CommandPalette
CommandPalette
CommandPaletteEmpty
CommandPaletteFooter
CommandPaletteGroup
CommandPaletteInput
CommandPaletteItem
CommandPaletteList
DateInput
Dialog
AlertDialog
Dialog
DialogHeader
useXDSImperativeAlertDialog
useXDSImperativeDialog
Divider
DropdownMenu
DropdownMenu
DropdownMenuDivider
DropdownMenuItem
DropdownMenuItemData
DropdownMenuSection
EmptyState
Field
Field
FieldLabel
FieldStatus
Heading
HoverCard
Icon
Kbd
Layout
Center
FormLayout
Grid
GridSpan
HStack
Layout
LayoutContainer
LayoutContent
LayoutFooter
LayoutHeader
LayoutPanel
Section
StackItem
VStack
Link
List
List
ListItem
Markdown
MetadataList
MetadataList
MetadataListItem
MobileNav
MoreMenu
NavIcon
NavMenuItem
NumberInput
OverflowList
Pagination
Popover
PowerSearch
ProgressBar
Radio
RadioList
RadioListItem
Resizable
ResizeHandle
useXDSResizable
SegmentedControl
SegmentedControl
SegmentedControlItem
SelectableCard
Selector
MultiSelector
Selector
SelectorOption
SideNav
SideNav
SideNavCollapseButton
SideNavHeading
SideNavItem
SideNavSection
Skeleton
Slider
Spinner
StatusDot
Switch
Table
BaseTable
Table
TableCell
TableHeaderCell
TableRow
useXDSTableColumnSettings
useXDSTablePagination
useXDSTableSelection
useXDSTableSelectionState
useXDSTableSortable
Tabs
Tab
TabList
TabMenu
Text
TextArea
TextInput
Thumbnail
TimeInput
Timestamp
Toast
Toast
useXDSToast
Token
Tokenizer
Toolbar
Tooltip
TopNav
TopNav
TopNavHeading
TopNavItem
TopNavMegaMenu
TopNavMegaMenuFeaturedCard
TopNavMegaMenuItem
TopNavMenu
TreeList
Typeahead
BaseTypeahead
Typeahead
TypeaheadItem
useXDSHoverCard
useXDSPopover
useXDSTooltip
Utilities
Utilities
LinkProvider
MediaTheme
SyntaxTheme
Theme
useClickableContainer
useEntryAnimation
useFocusTrap
useGridFocus
useImageMode
useInputContainer
useListFocus
useMediaQuery
useOverflow
useScrollLock
useScrollOverflow
useXDSLayer
useXDSStreamingText
Terms of UsePrivacy Policy
Type to search
↑↓Navigate↵SelectEscClose
CommandPalette@xds/core v0.0.13 · XDSCommandPalette

Usage

CommandPalette is a searchable dialog for quick access to commands, navigation, and actions. Use it as a keyboard-driven launcher powered by XDSSearchSource for filtering and selection.
ts
import {XDSCommandPalette} from '@xds/core/CommandPalette'

Best practices

GuidancePractices
DoProvide a searchSource with bootstrap results so users see useful options before typing.
DoUse auxiliaryData.group on items to automatically organize results into labeled sections.
Don'tUse CommandPalette for simple dropdowns or menus — use XDSMenu or XDSSelector for inline selections.
Don'tAdd too many groups or items — curate results to keep the palette fast and scannable.

Sub-components

CommandPalette is a compound component with 7 sub-components.

XDSCommandPalette

Root component. Manages open state, search, keyboard navigation, and composition slots.
PropTypeDescription
isOpenrequired
booleanWhether the command palette dialog is visible.
onOpenChangerequired
(isOpen: boolean) => voidCalled when the palette visibility changes.
searchSourcerequired
XDSSearchSource<T>Search source providing items via search(query) and bootstrap(). Use createStaticSource for static lists.
input
ReactNode (default: <XDSCommandPaletteInput />)Input slot. Defaults to XDSCommandPaletteInput with standard behavior.
footer
ReactNode (default: <XDSCommandPaletteFooter />)Footer slot. Defaults to XDSCommandPaletteFooter showing keyboard hints.
renderItem
(item: T, isSelected: boolean) => ReactNodePer-item render function. Auto-grouping by auxiliaryData.group is preserved. When omitted, renders label text.
emptySearchText
ReactNode (default: 'No results')Content shown when a search query returns no results.
emptyBootstrapText
ReactNode (default: 'Type to search')Content shown when there is no search query and bootstrap() returns nothing.
value
stringControlled selected value for picker mode.
onValueChange
(value: string) => voidCalled when the selected value changes in picker mode.
label
string (default: 'Command palette')Accessible label for the command palette dialog.
width
number | string (default: 640)Width of the dialog.
maxHeight
number | string (default: 480)Maximum height of the dialog.
isInline
boolean (default: false)Renders command palette content inline without modal behavior. For documentation previews and showcases only.

XDSCommandPaletteEmpty

Empty state display for the results area. Rendered automatically by XDSCommandPalette for no-results and no-query states.
PropTypeDescription
childrenrequired
ReactNodeMessage or content to display.

XDSCommandPaletteFooter

Footer showing keyboard navigation hints. Renders default arrow/Enter/Escape hints when no children are provided.
PropTypeDescription
children
ReactNodeCustom footer content. When omitted, renders default keyboard hints via XDSKbd.
xstyle
StyleXStylesStyleX styles for layout customization. Must be a stylex.create() value.

XDSCommandPaletteGroup

Visual grouping with a heading label. Place inside XDSCommandPaletteList.
PropTypeDescription
headingrequired
stringGroup heading text.
childrenrequired
ReactNodeXDSCommandPaletteItem children.
xstyle
StyleXStylesStyleX styles for layout customization. Must be a stylex.create() value.

XDSCommandPaletteInput

Search input slot. Auto-focuses on mount. Wires to command palette context when used inside XDSCommandPalette.
PropTypeDescription
placeholder
string (default: 'Search...')Placeholder text for the input.
hasAutoFocus
boolean (default: true)Auto-focus the input when mounted.
endContent
ReactNodeContent rendered at the trailing end of the input, after the spinner. Use for clear buttons or keyboard shortcut hints.
value
stringSearch value. When omitted inside XDSCommandPalette, reads from context.
onValueChange
(value: string) => voidCalled when search value changes. When omitted inside XDSCommandPalette, writes to context.
xstyle
StyleXStylesStyleX styles for layout customization. Must be a stylex.create() value.

XDSCommandPaletteItem

A selectable item. Accepts arbitrary children for full rendering control. Registers with context for keyboard navigation when inside XDSCommandPalette.
PropTypeDescription
valuerequired
stringUnique value for identification and selection.
childrenrequired
ReactNodeItem content — render icons, descriptions, keyboard shortcuts, etc.
onSelect
(value: string) => voidCalled when this item is selected via click or Enter.
isHighlighted
boolean (default: false)Whether this item has keyboard focus. Derived from context when inside XDSCommandPalette.
isSelected
boolean (default: false)Whether this item is selected in picker mode.
isDisabled
boolean (default: false)Whether the item is non-interactive.
xstyle
StyleXStylesStyleX styles for layout customization. Must be a stylex.create() value.

XDSCommandPaletteList

Scrollable results container. Renders as a listbox for ARIA. Contains XDSCommandPaletteItem and XDSCommandPaletteGroup children.
PropTypeDescription
childrenrequired
ReactNodeItems, groups, and empty states.
label
string (default: 'Commands')Accessible label for the listbox.
xstyle
StyleXStylesStyleX styles for layout customization. Must be a stylex.create() value.

Examples

Common configurations, variations, and states.
CommandPalette — Async Search
Server-side search with loading spinner and custom empty states.
CommandPalette — Grouped
Command palette with items grouped via auxiliaryData.group.
CommandPalette — Custom Footer
Command palette with a custom footer tip message.
CommandPalette — Picker Mode
Single-value picker with persistent selection and check indicator.
CommandPalette — Rich Items
Custom item rendering with icons, keyboard shortcuts, and keyword search.