Command
A searchable list of commands, like a command palette.
import {
Command,
CommandEmpty,
CommandGroup,
CommandInput,
CommandItem,
CommandList,
Surface
} from 'alinea/components'
import {
IcRoundFormatQuote,
IcRoundImage,
IcRoundNotes,
IcRoundPanorama
} from 'alinea/dashboard/icons'
export function CommandExample() {
return (
<Surface style={{width: 280}}>
<Command>
<CommandInput aria-label="Search blocks" placeholder="Add a block…" />
<CommandList aria-label="Blocks">
<CommandEmpty>No matching blocks</CommandEmpty>
<CommandGroup heading="Blocks">
<CommandItem value="text" icon={IcRoundNotes}>
Text
</CommandItem>
<CommandItem value="image" icon={IcRoundImage} keywords={['photo']}>
Image
</CommandItem>
<CommandItem value="hero" icon={IcRoundPanorama}>
Hero
</CommandItem>
<CommandItem value="quote" icon={IcRoundFormatQuote}>
Quote
</CommandItem>
</CommandGroup>
</CommandList>
</Command>
</Surface>
)
}Props
<Command>
A search input that filters a list of actions, as used in command palettes and pickers. Compose with CommandInput, CommandList, CommandEmpty, CommandGroup, CommandItem and CommandSeparator.
keywords holds the text of the item followed by its keywords. By default items are shown when their text or one of their keywords contains the query, ignoring case and accents.Also accepts className and style, id and aria-* labelling attributes and data-* attributes.
<CommandInput>
Also accepts className and style, id and aria-* labelling attributes and data-* attributes.
<CommandList>
Also accepts className and style, id and aria-* labelling attributes and data-* attributes.
<CommandEmpty>
Place directly inside CommandList
Also accepts className and style and data-* attributes.
<CommandGroup>
Also accepts className and style, id and aria-* labelling attributes and data-* attributes.
<CommandItem>
onSelect and the filterAlso accepts className and style and data-* attributes.
<CommandSeparator>
Accepts className and style and data-* attributes.