Providing a label
The only thing you must supply is alabel prop on Command. This text is read by screen readers to identify the control — it is never shown visually.
ARIA attributes set automatically
cmdk sets all required ARIA attributes so you don’t have to think about them.Input
TheCommand.Input renders as an <input> with:
List
Command.List renders as a <div> with:
Items
EachCommand.Item renders as a <div> with:
Groups
Command.Group uses a two-layer structure:
- The outer container has
role="presentation" - The inner items container has
role="group"andaria-labelledbypointing to the heading - The heading itself has
aria-hidden="true"— it is referenced byaria-labelledby, not read redundantly
Command.Dialog
Command.Dialog wraps Radix UI Dialog, which is fully accessible out of the box. It manages focus trapping, scroll locking, and the aria-modal attribute. Pass label to Command.Dialog — it is forwarded to the underlying DialogContent as aria-label:
The Dialog overlay is always rendered when
Command.Dialog is open. You can style it via [cmdk-overlay] and provide a custom class with overlayClassName.Keyboard navigation
cmdk handles all standard keyboard interactions:
Vim bindings can be disabled with
vimBindings={false} on Command.