Skip to content

Command

Free

A search field over a list of commands. People type a few letters to find an action or a page, as in a command palette or a quick switcher.

  • Base UI
  • React 19
  • Tailwind CSS 4

Added Nov 8, 2026 · MIT + Commons Clause

Playground

Loading the preview

Props

Compose the search and the list.

palette.tsx

Command

<div>
PropTypeDefaultDescription
itemsreadonly ItemValue[]—The data to filter: a flat array, or groups ({ value, items }). Nullish entries are not allowed.
size"default""lg""default"default, or lg for a Spotlight-style palette: a 44px search row with a 20px icon, 36px rows with 8px padding and gaps, a 6px list inset, and a 36px footer. Text stays 14px. The parts read it from the root (data-size).
From Base UICombobox.RootBase UI docs
childrenReactNode—
namestring—Identifies the field when a form is submitted.
idstring—The id of the component.
...props<div> attributes—Every other attribute goes to the <div>, with a ref.

CommandDialog

PropTypeDefaultDescription
classNamestring—
showCloseButtonbooleanfalseShow the corner close button. Default false: Escape closes the palette.
closeLabelstring"Close"The accessible name of the close button. Translate it with the page.
container—The element the dialog portals into (Base UI Dialog.Portal container).
childrenRequiredReactNode—
From Base UIDialog.RootBase UI docs
openboolean—Whether the dialog is currently open.
defaultOpenbooleanfalseWhether the dialog is initially open. To render a controlled dialog, use the open prop instead.
modal"trap-focus" | booleantrueDetermines if the dialog enters a modal state when open. - true: user interaction is limited to just the dialog: focus is trapped, document page scroll is locked, and pointer interactions on outside elements are disabled. - false: user interaction with the rest of the document is allowed. - 'trap-focus': focus is trapped inside the dialog, but document page scroll is not locked and pointer interactions outside of it remain enabled. When modal is true or 'trap-focus', render <Dialog.Close> inside <Dialog.Popup> so touch screen readers can escape the popup.

CommandInput

<input>
PropTypeDefaultDescription
classNamestring—
showClearbooleantrueShow the clear button while the field has text. Default true.
clearLabelstring"Clear search"The accessible name of the clear button. Translate it with the page.
From Base UICombobox.InputBase UI docs
disabledbooleanfalseWhether the component should ignore user interaction.
render—Allows you to replace the component's HTML element with a different tag, or compose it with another component. Accepts a ReactElement or a function that returns the element to render.
style—Style applied to the element, or a function that returns a style object based on the component's state.
...props<input> attributes—Every other attribute goes to the <input>, with a ref.

CommandList

<div>
PropTypeDefaultDescription
classNamestring—
From Base UICombobox.ListBase UI docs
children—
render—Allows you to replace the component's HTML element with a different tag, or compose it with another component. Accepts a ReactElement or a function that returns the element to render.
style—Style applied to the element, or a function that returns a style object based on the component's state.
...props<div> attributes—Every other attribute goes to the <div>, with a ref.

CommandEmpty

<div>
PropTypeDefaultDescription
classNamestring—
...props<div> attributes—Every other attribute goes to the <div>, with a ref.

CommandGroup

<div>
PropTypeDefaultDescription
classNamestring—
headingReactNode—The group name (the shadcn heading): the shared popup group label, 12/16 weight 500 muted.
From Base UICombobox.GroupBase UI docs
itemsreadonly any[]—Items to be rendered within this group. When provided, child Collection components will use these items.
render—Allows you to replace the component's HTML element with a different tag, or compose it with another component. Accepts a ReactElement or a function that returns the element to render.
style—Style applied to the element, or a function that returns a style object based on the component's state.
...props<div> attributes—Every other attribute goes to the <div>, with a ref.

CommandCollection

PropTypeDefaultDescription
From Base UICombobox.CollectionBase UI docs
childrenRequired—

CommandItem

<div>
PropTypeDefaultDescription
classNamestring—
From Base UIAutocomplete.ItemBase UI docs
childrenReactNode—
onClick—An optional click handler for the item when selected. It fires when clicking the item with the pointer, as well as when pressing Enter with the keyboard if the item is highlighted when the Input or List element has focus.
indexnumber—The index of the item in the list. Improves performance when specified by avoiding the need to calculate the index automatically from the DOM.
...props<div> attributes—Every other attribute goes to the <div>, with a ref.

CommandShortcut

<div>
PropTypeDefaultDescription
...props<div> attributes—Every other attribute goes to the <div>, with a ref.

CommandSeparator

<div>
PropTypeDefaultDescription
classNamestring—
From Base UIAutocomplete.SeparatorBase UI docs
orientation"horizontal""vertical"'horizontal'The orientation of the separator.
render—Allows you to replace the component's HTML element with a different tag, or compose it with another component. Accepts a ReactElement or a function that returns the element to render.
style—Style applied to the element, or a function that returns a style object based on the component's state.
...props<div> attributes—Every other attribute goes to the <div>, with a ref.

CommandFooter

<div>
PropTypeDefaultDescription
...props<div> attributes—Every other attribute goes to the <div>, with a ref.
  • Use CommandDialog for a palette over the page.
  • Use size="lg" for a Spotlight look.
  • Pass items for the data pattern.
  • For a value in a form, use a Combobox.
  • For a list that opens from a button, use a Menu.
UporDownMoves the lit row.
EnterRuns the lit row.
EscapeCloses the dialog.

Built with

Installs with Command

  1. AddedCommand, with Autocomplete, Dialog, Menu.
Open the release