Skip to content
RefineUI

Command

Command palette interface with search.

Dialog
Inline
Small
Medium
Large
Sizes

Overview

Machine-readable contract from Component Spec.

component: commandexport: Commandversion: 1attributes: data-refineui=command

Anatomy

Partdata-refineui
rootcommand
emptycommand-empty
groupcommand-group
group_headingcommand-group-heading
indicatorcommand-indicator
inputcommand-input
itemcommand-item
listcommand-list
separatorcommand-separator
shortcutcommand-shortcut

Variants

AxisValues
sizesm, md, lg

States

ScopeCategoryValues
componentpseudofocus-visible
componentcomponentdata-state: disabled, active, default
componentenvironmentforced-colors, dir

Accessibility

SlotElementRoleRequired attributes
command-itemdivoptionaria-selected: required=true, type: boolean

Keyboard

KeyActionNative
ArrowDownnext-trigger—
ArrowUpprevious-trigger—
Homefirst-trigger—
Endlast-trigger—
Enteractivate—

Focus

SectionPropertyValue
visualrequiredtrue
visualselector:focus-visible

Layout

PropertyValue
directionlogical
rtltrue
npm install @refineui/react @refineui/tokens
import {
Command,
CommandInput,
CommandList,
CommandEmpty,
CommandGroup,
CommandGroupHeading,
CommandItem,
CommandSeparator
} from "@refineui/react";
<Command>
<CommandInput placeholder="Search commands..." />
<CommandList>
<CommandEmpty>No results found.</CommandEmpty>
<CommandGroup>
<CommandGroupHeading>File</CommandGroupHeading>
<CommandItem value="new" onSelect={() => handleNew()}>
New File
</CommandItem>
<CommandItem value="open">Open</CommandItem>
</CommandGroup>
<CommandSeparator />
<CommandGroup>
<CommandGroupHeading>Edit</CommandGroupHeading>
<CommandItem value="copy">Copy</CommandItem>
<CommandItem value="paste">Paste</CommandItem>
</CommandGroup>
</CommandList>
</Command>
<CommandDialog open={isOpen} onOpenChange={setIsOpen}>
<CommandInput placeholder="Search commands..." />
<CommandList>{/* Same groups and items as above */}</CommandList>
</CommandDialog>
PropDefaultTypeDescription
size"md""sm" | "md" | "lg"Density of the search field, results panel radius, and item rows — same tiers as SearchField.
value—stringControlled search query.
defaultValue—stringUncontrolled initial search query.
onValueChange—(search: string) => voidEvent handler when search changes.
shouldFiltertruebooleanWhen true, filters items by search text.
filter—CommandFilterCustom score function (return 0 to hide).
selectedValue—stringControlled highlighted item value.
defaultSelectedValue—stringUncontrolled initial highlighted item.
onSelectedValueChange—(value: string) => voidEvent handler when highlighted item changes.
label—stringAccessible name (`aria-label`).

Command in a Dialog overlay.

PropDefaultTypeDescription
open—booleanControlled open state.
onOpenChange—(open: boolean) => voidEvent handler when open state changes.
commandProps—CommandPropsProps forwarded to inner Command. The Command size defaults to "lg" here; `size` on CommandDialog itself sets the dialog width.

Search input with optional startIcon.

List container that grows with its results up to a max height, then scrolls (uses ScrollArea internally). A single highlight slides to the selected item, and the height animates as results filter; both respect prefers-reduced-motion.

Shown when no items match.

Groups related items.

Heading for a group.

Visual divider.

PropDefaultTypeDescription
value—stringUnique value for filtering and selection (required).
keywords—string[]Extra strings for default filter.
onSelect—(value: string) => voidCalled when activated (click/Enter).
forceMountfalsebooleanKeep mounted when filtered out.
startIcon—ReactNodeLeading icon.
endIcon—ReactNodeTrailing icon.
shortcut—ReactNodeKeyboard shortcut hint.