콘텐츠로 이동
RefineUI

Command

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

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
inputcommand-input
itemcommand-item
listcommand-list
separatorcommand-separator
shortcutcommand-shortcut

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}>
<Command>
{/* Command content */}
</Command>
</CommandDialog>
PropDefaultTypeDescription
valuestring제어형 검색 쿼리.
defaultValuestring비제어형 초기 검색 쿼리.
onValueChange(search: string) => void검색 변경 시 이벤트 핸들러.
shouldFiltertruebooleantrue이면 검색 텍스트로 항목을 필터링합니다.
filterCommandFilter커스텀 점수 함수(0을 반환하면 숨김).
selectedValuestring제어형 하이라이트 항목 값.
defaultSelectedValuestring비제어형 초기 하이라이트 항목.
onSelectedValueChange(value: string) => void하이라이트 항목 변경 시 이벤트 핸들러.
labelstring접근 가능한 이름(`aria-label`).

Dialog 오버레이 안의 Command.

PropDefaultTypeDescription
openboolean제어형 열림 상태.
onOpenChange(open: boolean) => void열림 상태 변경 시 이벤트 핸들러.
commandPropsCommandProps내부 Command로 전달되는 props.

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

스크롤 가능한 리스트 컨테이너(내부적으로 ScrollArea 사용).

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

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

그룹 제목.

시각적 구분선.

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