kliping.pro
  • Docs
  • Explore
  • Builder
  • Directory
  • Colors
  • Typeset
Saved
Docs
  • Sections13
  • Installation5
  • Dark Mode4
  • Forms3
  • Registry6
  • Utilities2
  • More10
  • Components137
  • Accordion
  • Action Bar
  • AI Chat
  • AI Thread List
  • Alert
  • Alert Dialog
  • Angle Slider
  • Animated Grid Pattern
  • Aspect Ratio
  • Attachment
  • Avatar
  • Avatar Group
  • Badge
  • Badge Overflow
  • Banner
  • Border Beam
  • Breadcrumb
  • Bubble
  • Button
  • Button Group
  • Calendar
  • Card
  • Carousel
  • Chart
  • Checkbox
  • Checkbox Group
  • Chip
  • Circular Progress
  • Client Only
  • Collapsible
  • Color Picker
  • Color Swatch
  • Combobox
  • Combobox Advanced
  • Command
  • Compare Slider
  • Composition
  • Context Menu
  • Cropper
  • Data Grid
  • Data Table
  • Data Table Advanced
  • Date Picker
  • Dialog
  • Direction Provider
  • Dot Pattern
  • Drawer
  • Dropdown Menu
  • Editable
  • Empty
  • Field
  • File Upload
  • Form
  • FPS
  • Gauge
  • Hitbox
  • Hover Card
  • Input
  • Input Group
  • Input OTP
  • Item
  • Kanban
  • Kbd
  • Kbd Advanced
  • Key Value
  • Label
  • List
  • Listbox
  • Logos
  • Map
  • Marker
  • Marquee
  • Mask Input
  • Masonry
  • Media Player
  • Mention
  • Menubar
  • Message
  • Message Scroller
  • Native Select
  • Navigation Menu
  • Number Field
  • Pagination
  • Particles
  • Pending
  • Phone Input
  • Pin Input
  • Popover
  • Portal
  • Presence
  • Progress
  • QR Code
  • Questionnaire
  • Radio Group
  • Range Calendar
  • Rating
  • Relative Time Card
  • Resizable
  • Responsive Dialog
  • Scroll Area
  • Scroll Spy
  • Scroller
  • Segmented Input
  • Select
  • Selection Toolbar
  • Separator
  • Sheet
  • Sidebar
  • Skeleton
  • Slider
  • Software Purchase Card
  • Sonner
  • Sortable
  • Speed Dial
  • Spinner
  • Stack
  • Stat
  • Status
  • Stepper
  • Stepper Advanced
  • Swap
  • Switch
  • Table
  • Tabs
  • Tags Input
  • Tags Input Advanced
  • Textarea
  • Time Picker
  • Timeline
  • Toast
  • Toggle
  • Toggle Group
  • Tooltip
  • Tour
  • Typography
  • Visually Hidden
  • Visually Hidden Input
  1. Docs
  2. Components
  3. Drawer

Drawer

PreviousNext

Komponen laci geser yang dirancang untuk perangkat mobile.

Docs API Reference

Installation ​

pnpm dlx kliping@latest add drawer

Pasang dependensi berikut:

pnpm add reka-ui

Salin dan tempel kode sumber di GitHub ke project Anda.

Sesuaikan path import dengan struktur project Anda.

Usage ​

vue
<script setup lang="ts">
import {
  Drawer,
  DrawerClose,
  DrawerContent,
  DrawerDescription,
  DrawerFooter,
  DrawerHeader,
  DrawerTitle,
  DrawerTrigger,
} from '@/components/ui/drawer'
</script>

<template>
  <Drawer>
    <DrawerTrigger>Open</DrawerTrigger>
    <DrawerContent>
      <DrawerHeader>
        <DrawerTitle>Are you absolutely sure?</DrawerTitle>
        <DrawerDescription>
          This action cannot be undone.
        </DrawerDescription>
      </DrawerHeader>
      <DrawerFooter>
        <Button>Submit</Button>
        <DrawerClose>
          <Button variant="outline">
            Cancel
          </Button>
        </DrawerClose>
      </DrawerFooter>
    </DrawerContent>
  </Drawer>
</template>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34

Examples ​

Konten yang Bisa Digulir ​

Menjaga tombol aksi tetap terlihat selagi kontennya digulir.

Sisi ​

Pakai prop swipe-direction untuk menentukan ke arah mana drawer digeser saat ditutup. Drawer menempel pada sisi yang jadi arah penutupannya — up membuka drawer di sisi atas, down di sisi bawah. Pilihannya: up, right, down, dan left.

Modal Responsif (Dialog & Drawer) ​

Pakai komponen Drawer untuk layar kecil, dan Dialog untuk layar yang lebih lebar. Pola ini bisa Anda jadikan komponen pakai-ulang dengan memanfaatkan slot untuk tiap bagian modal.

Requirements ​

Semua dipasang otomatis oleh kliping add; tabel ini untuk Anda yang memasang manual atau memeriksa project.

RequirementValue
ProjectVue 3.5+, Tailwind CSS v4, alias @ — disiapkan kliping init
npm packages@vueuse/core@^14.4.0, reka-ui@^2.10.3
Filescomponents/ui/drawer/drawer.vue
components/ui/drawer/drawer-close.vue
components/ui/drawer/drawer-content.vue
components/ui/drawer/drawer-description.vue
components/ui/drawer/drawer-footer.vue
components/ui/drawer/drawer-header.vue
components/ui/drawer/drawer-overlay.vue
components/ui/drawer/drawer-title.vue
components/ui/drawer/drawer-trigger.vue
components/ui/drawer/index.ts

Anatomy ​

Susunan bagiannya seperti dipakai di contoh-contoh di atas. Impor semua bagian dari satu tempat, lalu susun begini:

vue
<Drawer>
  <DrawerTrigger />
  <DrawerContent>
    <DrawerHeader>
      <DrawerTitle />
      <DrawerDescription />
    </DrawerHeader>
    <DrawerFooter>
      <DrawerClose />
    </DrawerFooter>
  </DrawerContent>
</Drawer>

Bagian lain yang tersedia: DrawerOverlay.

API Reference ​

Drawer ​

PropTypeDefaultDescription
defaultSnapPoint?DrawerSnapPoint—Snap point the drawer opens at when uncontrolled (one of snapPoints).
open?boolean—v-model:open
defaultOpen?boolean—The initial open state when uncontrolled.
modal?DrawerModal—Modality of the drawer. - true (default): modal with focus trap, scroll lock, and outside-press dismiss - 'trap-focus': traps focus but allows outside pointer events (non-modal side panels) - false: non-modal
swipeDirection?SwipeDirection$1—Direction to swipe to dismiss.
snapPoints?DrawerSnapPoint[]—Preset snap positions (fractions 0-1, pixels >1, or '148px'/'30rem' strings)
snapPoint?DrawerSnapPoint—v-model:snapPoint
snapToSequentialPoints?boolean—When true, snaps to the next sequential snap point (one step at a time). When false, snaps to the nearest snap point by distance.
EventPayloadDescription
@update:open[value: boolean, details?: DrawerOpenChangeDetails | undefined]Emitted when the open state changes.
@update:openComplete[value: boolean]Emitted when the open or close animation finishes, with the open state.
@update:snapPoint[value: DrawerSnapPoint | null]Emitted when snapPoint changes. Bind with v-model:snapPoint.
SlotProps
#default{ open: boolean; close: () => void; }

DrawerClose ​

PropTypeDefaultDescription
asChild?boolean—Change the default rendered element for the one passed as a child, merging their props and behavior. Read our Composition guide for more details.
as?AsTag | Component—The element or component this component should render as. Can be overwritten by asChild.
SlotProps
#default—
Data attributeValue
[data-slot]"drawer-close"

DrawerContent ​

PropTypeDefaultDescription
forceMount?boolean—Keep the content mounted while closed, e.g. to control the animation yourself.
asChild?boolean—Change the default rendered element for the one passed as a child, merging their props and behavior. Read our Composition guide for more details.
as?AsTag | Component—The element or component this component should render as. Can be overwritten by asChild.
disableOutsidePointerEvents?boolean—When true, hover/focus/click interactions will be disabled on elements outside the DismissableLayer. Users will need to click twice on outside elements to interact with them: once to close the DismissableLayer, and again to trigger the element.
initialFocus?boolean | HTMLElement—Initial focus target when the drawer opens. - true / default: focus the first focusable element inside - false: do not focus anything - element ref: focus that specific element
finalFocus?boolean | HTMLElement—Final focus target when the drawer closes. - true / default: focus the trigger - false: do not restore focus - element ref: focus that specific element
EventPayloadDescription
@escapeKeyDown[event: KeyboardEvent]Emitted when Escape is pressed; call event.preventDefault() to keep it open.
@pointerDownOutside[event: PointerDownOutsideEvent]Emitted on a pointer down outside; call event.preventDefault() to keep it open.
@focusOutside[event: FocusOutsideEvent]Emitted when focus moves outside; call event.preventDefault() to keep it open.
@interactOutside[event: PointerDownOutsideEvent | FocusOutsideEvent]Emitted on any pointer down or focus outside; call event.preventDefault() to keep it open.
@openAutoFocus[event: Event]Emitted when focus moves in on open; call event.preventDefault() to stop it.
@closeAutoFocus[event: Event]Emitted when focus returns on close; call event.preventDefault() to stop it.
SlotProps
#default—
Data attributeValue
[data-slot]"drawer-content"
[data-swiping]set at runtime

DrawerDescription ​

PropTypeDefaultDescription
asChild?boolean—Change the default rendered element for the one passed as a child, merging their props and behavior. Read our Composition guide for more details.
as?AsTag | Component—The element or component this component should render as. Can be overwritten by asChild.
SlotProps
#default—
Data attributeValue
[data-slot]"drawer-description"

DrawerFooter ​

SlotProps
#default—
Data attributeValue
[data-slot]"drawer-footer"

DrawerHeader ​

SlotProps
#default—
Data attributeValue
[data-slot]"drawer-header"

DrawerOverlay ​

PropTypeDefaultDescription
forceMount?boolean—Keep mounted for animation control.
forceRender?boolean—Render even when inside a nested drawer.
asChild?boolean—Change the default rendered element for the one passed as a child, merging their props and behavior. Read our Composition guide for more details.
as?AsTag | Component—The element or component this component should render as. Can be overwritten by asChild.
Data attributeValue
[data-slot]"drawer-overlay"

DrawerTitle ​

PropTypeDefaultDescription
asChild?boolean—Change the default rendered element for the one passed as a child, merging their props and behavior. Read our Composition guide for more details.
as?AsTag | Component—The element or component this component should render as. Can be overwritten by asChild.
SlotProps
#default—
Data attributeValue
[data-slot]"drawer-title"

DrawerTrigger ​

PropTypeDefaultDescription
asChild?boolean—Change the default rendered element for the one passed as a child, merging their props and behavior. Read our Composition guide for more details.
as?AsTag | Component—The element or component this component should render as. Can be overwritten by asChild.
SlotProps
#default—
Data attributeValue
[data-slot]"drawer-trigger"

Keyboard Interactions ​

Perilaku keyboard-nya datang dari primitif Reka UI Drawer yang dipakai komponen ini, mengikuti pola WAI-ARIA.

KeyDescription
SpaceOpens/closes the drawer.
EnterOpens/closes the drawer.
TabMoves focus to the next focusable element.
Shift + TabMoves focus to the previous focusable element.
EscCloses the drawer and moves focus to DrawerTrigger.

CSS Variables ​

Token tema yang dibaca komponen ini — ubah nilainya di CSS global (:root dan .dark, lihat Theming) untuk mengubah tampilannya tanpa menyentuh komponennya: --background, --foreground, --muted, --muted-foreground, --radius.

Credits ​

Berasal dari shadcn-vue (MIT, Copyright (c) 2023 unovue). Rantai lengkapnya di Credits.

PreviousDot PatternNext Dropdown Menu

On This Page

InstallationUsageExamplesKonten yang Bisa DigulirSisiModal Responsif (Dialog & Drawer)RequirementsAnatomyAPI ReferenceDrawerDrawerCloseDrawerContentDrawerDescriptionDrawerFooterDrawerHeaderDrawerOverlayDrawerTitleDrawerTriggerKeyboard InteractionsCSS VariablesCredits

© 2026 Kliping. Free components are open source under the MIT License.

LicenseCreditsRoadmap