Documentation Index
Fetch the complete documentation index at: https://mintlify.com/dip/cmdk/llms.txt
Use this file to discover all available pages before exploring further.
Command.Dialog wraps Command in a Radix UI Dialog, giving you a modal overlay without writing the boilerplate yourself. All props accepted by Command are also accepted by Command.Dialog and forwarded directly to the inner Command component.
[cmdk-dialog] on the dialog content, [cmdk-overlay] on the backdrop overlay.
The overlay is always rendered when the dialog is open. Style it with
[cmdk-overlay] in your CSS.Props
Command.Dialog accepts all props from Command plus the following dialog-specific props:
Controls whether the dialog is open. Use together with
onOpenChange for controlled state.Callback fired when the open state changes. Receives the new open state.
A
className applied to the dialog overlay element ([cmdk-overlay]). Use this to apply Tailwind classes or other class-based styles to the backdrop.A
className applied to the dialog content element ([cmdk-dialog]). Use this to position and size the modal panel.An HTML element to portal the dialog into. Forwarded to Radix’s Dialog Portal. Defaults to
document.body.Command are also accepted and forwarded:
Accessible label for the command menu. Sets
aria-label on the dialog content.Set to
false to disable automatic filtering and sorting.Custom filter function for ranking items against the search query.
The initially selected item value.
Controlled value of the selected item.
Callback fired when the selected item changes.
Enable wrap-around keyboard navigation.
Disable selecting items by pointer movement.
Enable
Ctrl+N/J/P/K navigation shortcuts.Examples
Open and close with state
Toggle the dialog using auseState boolean. Bind a keyboard shortcut to open it:
Custom portal container
By default the dialog portals intodocument.body. Pass a container ref to portal into a specific element instead:
