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

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>

Close Button

showCloseButton으로 닫기 버튼 표시 여부를 제어할 수 있습니다. closeIcon으로 아이콘을 교체할 수도 있습니다.

{/* Hide close button */}
<Drawer.Content showCloseButton={false}>...</Drawer.Content>

{/* Custom close icon */}
<Drawer.Content closeIcon={<ArrowRight />}>...</Drawer.Content>

API

Component Structure

Drawer— Radix Dialog
.Trigger.ContentProps.Header.Title.Description.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)

showCloseButtontrue
boolean

내장 닫기 버튼 표시

closeIconBuilt-in SVG icon
ReactNode

커스텀 닫기 아이콘

Drawer.Close

asChildfalse
boolean

자식 요소를 트리거로 사용

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-labelledby Title에 자동 연결
  • aria-describedby Description에 자동 연결
  • aria-modal="true" Radix가 자동 설정
  • 오버레이 클릭으로 닫힘
  • 배경 스크롤 잠금