Drawer
A panel that slides in from any edge and closes with a swipe, with snap points for a half-open state, such as filters or a mini cart on a phone.
Parts
| Part | File | Does |
|---|---|---|
| Drawer | Drawer.vue | Groups all parts of the drawer. |
| DrawerBody | DrawerBody.vue | Holds the drawer's main content and scrolls it when the drawer reaches its height cap, keeping the header and footer in view. |
| DrawerClose | DrawerClose.vue | Closes the drawer. |
| DrawerContent | DrawerContent.vue | Holds what the drawer shows while open. |
| DrawerDescription | DrawerDescription.vue | Explains the purpose of the drawer below its title. |
| DrawerFooter | DrawerFooter.vue | Holds the actions of the drawer, such as apply and cancel buttons. |
| DrawerHeader | DrawerHeader.vue | Groups the title and description at the top of the drawer. |
| DrawerOverlay | DrawerOverlay.vue | Covers the page behind the open drawer. |
| DrawerTitle | DrawerTitle.vue | Names the drawer. |
| DrawerTrigger | DrawerTrigger.vue | Opens the drawer. |
Anatomy
<Drawer>
<DrawerTrigger />
<DrawerContent>
<DrawerHeader>
<DrawerTitle />
<DrawerDescription />
</DrawerHeader>
<DrawerBody />
<DrawerFooter>
<DrawerClose />
</DrawerFooter>
</DrawerContent>
</Drawer>Styling
All of Drawer’s styles live in drawer.json. New to styling in Frontic UI? How styling works →
Install
- Installs with it
- focus
- npm packages
- @vueuse/core
- class-variance-authority
- reka-ui
API reference
Groups all parts of the drawer.
Props 8
| Prop | Type | Default | |
|---|---|---|---|
| open | boolean | — | |
| |||
| defaultOpen | boolean | false | |
| |||
| modal | DrawerModal | true | |
| |||
| swipeDirection | SwipeDirection | 'down' | |
| |||
| snapPoints | DrawerSnapPoint[] | — | |
| |||
| snapPoint | DrawerSnapPoint | null | — | |
| |||
| defaultSnapPoint | DrawerSnapPoint | null | — | |
| |||
| snapToSequentialPoints | boolean | false | |
| |||
Events 3
| Event | Payload | |
|---|---|---|
| update:open | value: boolean, details: DrawerOpenChangeDetails | |
| ||
| update:openComplete | value: boolean | |
| ||
| update:snapPoint | value: DrawerSnapPoint | null | |
| ||
Slots 1
| Slot | Slot props | |
|---|---|---|
| default | { open: boolean; close: () => void; } | |
| ||