Skip to content

Drawer

A drawer component for Vue.

Examples

Default

vue
<Drawer>
  <DrawerTrigger as-child>
    <Button variant="outline">Open Drawer</Button>
  </DrawerTrigger>
  <DrawerContent>
    <div class="mx-auto w-full max-w-sm">
      <DrawerHeader>
        <DrawerTitle>Move Goal</DrawerTitle>
        <DrawerDescription>Set your daily activity goal.</DrawerDescription>
      </DrawerHeader>
      <div class="p-4 pb-0">
        <div class="flex items-center justify-center space-x-2">
          <span class="text-4xl font-bold tracking-tighter">
            400
          </span>
          <span class="text-[0.70rem] uppercase text-muted-foreground">
            Calories/day
          </span>
        </div>
      </div>
      <DrawerFooter>
        <Button>Submit</Button>
        <DrawerClose as-child>
          <Button variant="outline">
            Cancel
          </Button>
        </DrawerClose>
      </DrawerFooter>
    </div>
  </DrawerContent>
</Drawer>

Props

Drawer

PropTypeDefaultDescription
activeSnapPointstring | number-The current active snap point.
closeThresholdnumber-The fraction of the drag distance that determines when the drawer should close.
shouldScaleBackgroundbooleantrueWhether the background should scale when the drawer is open.
scrollLockTimeoutnumber-The duration in milliseconds to wait before unlocking scrolling.
fixedboolean-Whether the drawer is fixed.
dismissiblebooleantrueWhether the drawer can be dismissed.
modalbooleantrueWhether the drawer is modal.
openboolean-Whether the drawer is open.
defaultOpenboolean-Whether the drawer is open by default.

Slots

Drawer

SlotDescription
defaultThe content of the drawer.