콘텐츠로 이동
RefineUI

Command

검색이 있는 커맨드 팔레트 인터페이스.

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>{/* 위와 같은 그룹과 항목 */}</CommandList>
</CommandDialog>
PropDefaultTypeDescription
size"md""sm" | "md" | "lg"검색 필드, 결과 패널 반경, 항목 행의 밀도 — SearchField와 같은 단계.
value—string제어형 검색 쿼리.
defaultValue—string비제어형 초기 검색 쿼리.
onValueChange—(search: string) => void검색 변경 시 이벤트 핸들러.
shouldFiltertruebooleantrue이면 검색 텍스트로 항목을 필터링합니다.
filter—CommandFilter커스텀 점수 함수(0을 반환하면 숨김).
selectedValue—string제어형 하이라이트 항목 값.
defaultSelectedValue—string비제어형 초기 하이라이트 항목.
onSelectedValueChange—(value: string) => void하이라이트 항목 변경 시 이벤트 핸들러.
label—string접근 가능한 이름(`aria-label`).

Dialog 오버레이 안의 Command.

PropDefaultTypeDescription
open—boolean제어형 열림 상태.
onOpenChange—(open: boolean) => void열림 상태 변경 시 이벤트 핸들러.
commandProps—CommandProps내부 Command로 전달되는 props. 여기서 Command 크기 기본값은 "lg"이며, CommandDialog 자체의 `size`는 다이얼로그 너비입니다.

선택적 startIcon이 있는 검색 입력.

결과 수에 맞춰 최대 높이까지 늘어나고, 넘치면 스크롤되는 리스트 컨테이너(내부적으로 ScrollArea 사용). 선택 항목으로 하이라이트 하나가 미끄러지듯 이동하고, 검색 결과가 바뀌면 높이가 부드럽게 변합니다. 둘 다 prefers-reduced-motion을 따릅니다.

일치하는 항목이 없을 때 표시.

관련 항목을 그룹화합니다.

그룹 제목.

시각적 구분선.

PropDefaultTypeDescription
value—string필터링·선택용 고유 값(필수).
keywords—string[]기본 필터용 추가 문자열.
onSelect—(value: string) => void활성화 시 호출(클릭/Enter).
forceMountfalseboolean필터로 제외되어도 마운트 유지.
startIcon—ReactNode앞쪽 아이콘.
endIcon—ReactNode뒤쪽 아이콘.
shortcut—ReactNode키보드 단축키 힌트.