Drawer
Drawer는 화면 가장자리에서 슬라이드 인하는 패널 컴포넌트입니다. 내비게이션, 설정, 상세 정보, 폼 등 보조 콘텐츠를 표시하는 데 적합합니다.
4
Sides
5
Sizes
Built-in
Scroll
Radix
Base
Playground
Preview
MDRight
Drawer
Side
Size
Content
Options
Button Style
Cancel
Save
const [open, setOpen] = useState(false)
<Drawer open={open} onOpenChange={setOpen}>
<Drawer.Trigger asChild>
<Button variant="outline">Open Drawer</Button>
</Drawer.Trigger>
<Drawer.Content>
<Drawer.Header>
<Drawer.Title>Drawer Title</Drawer.Title>
<Drawer.Description>This is a description of the drawer.</Drawer.Description>
</Drawer.Header>
<Drawer.Body>
<p>This is a drawer panel. You can place any content here, including navigation, forms, or detail views.</p>
</Drawer.Body>
<Drawer.Footer>
<Drawer.Close asChild>
<Button variant="ghost" size="md" pressEffect={false}>Cancel</Button>
</Drawer.Close>
<Button size="md" pressEffect={false}>Save</Button>
</Drawer.Footer>
</Drawer.Content>
</Drawer>Sizes
sm사이드 패널 또는 설정Left/Right: width320px
Top/Bottom: height320px
md (default)표준 (기본값)Left/Right: width400px
Top/Bottom: height400px
lg복잡한 폼Left/Right: width480px
Top/Bottom: height480px
xl상세 콘텐츠Left/Right: width640px
Top/Bottom: height640px
full전체 크기Left/Right: width100%
Top/Bottom: height100%
패딩 (전 사이즈 공통)
Header24px, bottom 0
Body24px
Footer24px, top 0
Closeright 16px, top 16px
| Size | 좌/우 | 상/하 | 용도 |
|---|---|---|---|
sm | width: 320px | height: 320px | 사이드 패널 또는 설정 |
md | width: 400px | height: 400px | 표준 (기본값) |
lg | width: 480px | height: 480px | 복잡한 폼 |
xl | width: 640px | height: 640px | 상세 콘텐츠 |
full | width: 100% | height: 100% | 전체 크기 |
패딩 (전 사이즈 공통)
Header
p-6 pb-0
24px, bottom 0
Body
p-6
24px
Footer
p-6 pt-0
24px, top 0
Close
right-4 top-4
16px
Features
Side Placement
left, right, top, bottom 4방향에서 슬라이드 인합니다. 기본값은 right입니다.
<Drawer.Content side="left">...</Drawer.Content>
<Drawer.Content side="right">...</Drawer.Content>
<Drawer.Content side="top">...</Drawer.Content>
<Drawer.Content side="bottom">...</Drawer.Content>API
Component Structure
Drawer— Radix Dialog.Trigger.ContentProps.Header.Title.Description.Body.Footer.CloseProps.Overlay.Portal
.Trigger트리거 요소.ContentProps패널 (side · size · close).Header헤더 영역.Title타이틀 (aria-labelledby).Description보조 텍스트 (aria-describedby).Body콘텐츠 영역 (스크롤 지원).Footer액션 영역.CloseProps닫기 버튼.Overlay배경 오버레이.Portal포털Props
Drawer.Content
side"right""left" | "right" | "top" | "bottom"슬라이드 방향
size"md""sm" | "md" | "lg" | "xl" | "full"패널 사이즈 (좌우 = 너비, 상하 = 높이: 320/400/480/640/full)
showCloseButtontrueboolean내장 닫기 버튼 표시
closeIconBuilt-in SVG iconReactNode커스텀 닫기 아이콘
| Name | Type | Default | Description |
|---|---|---|---|
side | "left" | "right" | "top" | "bottom" | "right" | 슬라이드 방향 |
size | "sm" | "md" | "lg" | "xl" | "full" | "md" | 패널 사이즈 (좌우 = 너비, 상하 = 높이: 320/400/480/640/full) |
showCloseButton | boolean | true | 내장 닫기 버튼 표시 |
closeIcon | ReactNode | Built-in SVG icon | 커스텀 닫기 아이콘 |
Drawer.Close
asChildfalseboolean자식 요소를 트리거로 사용
| Name | Type | Default | Description |
|---|---|---|---|
asChild | boolean | false | 자식 요소를 트리거로 사용 |
Anatomy
1
2
3
4
Drawer title
5
6
7
1
Overlay
배경 오버레이
2
Content
사이드 패널 본체
3
Header
타이틀 영역
4
Title
제목 텍스트
5
Close
닫기 버튼
6
Body
메인 콘텐츠
7
Footer
액션 버튼
Best Practices
✓
권장
- ✓보조 콘텐츠나 내비게이션에 Drawer를 사용하세요
- ✓메인 콘텐츠 맥락을 유지해야 할 때 Drawer를 선택하세요
- ✓콘텐츠 용도에 맞는 side를 선택하세요 (내비 → left, 상세 → right)
- ✓Footer에 액션 버튼을 배치해 조작을 명확히 하세요
✕
지양
- ✕중요한 확인 다이얼로그에 Drawer 대신 Modal을 사용하세요
- ✕Drawer 안에 Drawer를 중첩하지 마세요
- ✕단계가 많은 위저드에 Drawer를 사용하지 말고 전용 페이지로 이동하세요
- ✕full 사이즈를 남용하지 마세요. 모바일에서 전체 화면으로 보일 수 있습니다
Accessibility
키보드 조작
EscDrawer를 닫습니다
TabDrawer 내에서 포커스 순환
ARIA / WCAG
role="dialog"Radix가 자동 설정aria-labelledbyTitle에 자동 연결aria-describedbyDescription에 자동 연결aria-modal="true"Radix가 자동 설정- 오버레이 클릭으로 닫힘
- 배경 스크롤 잠금