XDSCommandPaletteGroup@xds/core · CommandPalette
Preview coming soon

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.

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.

Import

ts
import {XDSCommandPaletteGroup} from '@xds/core/CommandPalette'

Props

PropTypeDescription
headingrequired
stringGroup heading text.
childrenrequired
ReactNodeXDSCommandPaletteItem children.
xstyle
StyleXStylesStyleX styles for layout customization. Must be a stylex.create() value.

Showcase source

tsx
'use client';
import {useMemo} from 'react';
import {
XDSCommandPalette,
XDSCommandPaletteList,
XDSCommandPaletteGroup,
XDSCommandPaletteItem,
} from '@xds/core/CommandPalette';
import {createStaticSource} from '@xds/core/Typeahead';
import {XDSStack} from '@xds/core/Layout';
import {XDSText} from '@xds/core/Text';
export default function CommandPaletteGroupShowcase() {
const source = useMemo(
() =>
createStaticSource([
{id: 'index', label: 'index.tsx', auxiliaryData: {group: 'Recent Files'}},
{id: 'app', label: 'App.tsx', auxiliaryData: {group: 'Recent Files'}},
{id: 'settings', label: 'Open Settings', auxiliaryData: {group: 'Commands'}},
{id: 'terminal', label: 'Toggle Terminal', auxiliaryData: {group: 'Commands'}},
{id: 'theme', label: 'Color Theme', auxiliaryData: {group: 'Preferences'}},
{id: 'font', label: 'Font Size', auxiliaryData: {group: 'Preferences'}},
]),
[],
);
return (
<XDSStack direction="vertical" gap={4}>
<XDSStack direction="vertical" gap={1}>
<XDSText type="supporting" color="secondary">
Data-driven grouping (auxiliaryData.group)
</XDSText>
<XDSCommandPalette
isOpen
isInline
onOpenChange={() => {}}
searchSource={source}
/>
</XDSStack>
<XDSStack direction="vertical" gap={1}>
<XDSText type="supporting" color="secondary">
Composed form (XDSCommandPaletteGroup + XDSCommandPaletteItem)
</XDSText>
<XDSCommandPaletteList>
<XDSCommandPaletteGroup heading="Navigation">
<XDSCommandPaletteItem value="home" onSelect={() => {}}>
Home
</XDSCommandPaletteItem>
<XDSCommandPaletteItem value="dashboard" onSelect={() => {}}>
Dashboard
</XDSCommandPaletteItem>
</XDSCommandPaletteGroup>
<XDSCommandPaletteGroup heading="Actions">
<XDSCommandPaletteItem value="new-file" onSelect={() => {}}>
New File
</XDSCommandPaletteItem>
<XDSCommandPaletteItem value="save" onSelect={() => {}}>
Save All
</XDSCommandPaletteItem>
</XDSCommandPaletteGroup>
</XDSCommandPaletteList>
</XDSStack>
</XDSStack>
);
}