Install
Run this in the app, after shadcn-vue init and the Beehexa theme (Button › Code):
npx shadcn-vue@latest add https://beehexa.design/r/drawer.json
Use
<script setup lang="ts">
import { Button } from '@/components/ui/button'
import {
Drawer, DrawerClose, DrawerContent, DrawerDescription, DrawerFooter, DrawerHeader, DrawerTitle, DrawerTrigger,
} from '@/components/ui/drawer'
</script>
<template>
<Drawer>
<DrawerTrigger as-child>
<Button variant="outline">Sync schedule</Button>
</DrawerTrigger>
<DrawerContent>
<DrawerHeader>
<DrawerTitle>Sync schedule</DrawerTitle>
<DrawerDescription>How often orders move to the ERP.</DrawerDescription>
</DrawerHeader>
<!-- body: px-(--bh-space-modal) -->
<DrawerFooter>
<DrawerClose as-child><Button variant="outline">Cancel</Button></DrawerClose>
<Button>Save</Button>
</DrawerFooter>
</DrawerContent>
</Drawer>
</template>
Props
| Part | Prop | Values | Notes |
|---|---|---|---|
Drawer |
open, defaultOpen |
boolean | Controlled (v-model:open) or initial state |
Drawer |
swipeDirection |
down (default), up, left, right |
The edge it comes from and is swiped back to. Only down shows the grab bar |
Drawer |
snapPoints, snapPoint |
numbers or strings | Heights it stops at |
Drawer |
modal |
boolean | Default true: the page behind can’t be used |
DrawerTrigger, DrawerClose |
as-child |
boolean | Use it, so the trigger is your Button |
Built on
The reka-ui Drawer, with the shadcn-vue Drawer API. reka-ui gives role="dialog", aria-modal, the focus trap, swipe handling and Esc. Beehexa adds the styles.
Limitations
- The slide uses the shadcn-vue timing (500 ms, a spring-like curve), not the motion tokens.