UIDrawer
UIDrawer
A panel that slides in from the edge of the screen.
<template> <UIButton @click="showDrawer">Open Drawer</UIButton>
<UIDrawer v-model:visible="visible" title="Drawer Title" placement="right" :width="520" @close="handleClose" > <template #header> <div class="flex items-center"> <IconComponent class="mr-2" /> Custom Header </div> </template>
<div class="p-4"> Drawer Content </div>
<template #footer> <div class="flex justify-end space-x-2"> <UIButton @click="handleCancel">Cancel</UIButton> <UIButton type="primary" @click="handleOk">OK</UIButton> </div> </template> </UIDrawer></template>
<script setup lang="ts">const visible = ref(false)
const showDrawer = () => { visible.value = true}
const handleClose = () => { visible.value = false}
const handleCancel = () => { visible.value = false}
const handleOk = () => { // Handle confirmation visible.value = false}</script>Props
visible(boolean): Control drawer visibilitytitle(string): Drawer titleplacement(‘left’ | ‘right’ | ‘top’ | ‘bottom’): Drawer positionwidth(number | string): Drawer width (for left/right)height(number | string): Drawer height (for top/bottom)mask(boolean): Show background maskmaskClosable(boolean): Close on mask clickclosable(boolean): Show close buttonkeyboard(boolean): Close on ESC keyzIndex(number): Z-index valuedestroyOnClose(boolean): Destroy content on closegetContainer(string | HTMLElement): Container element
Events
update:visible: Emitted when visibility changesclose: Emitted when drawer closesafterVisibleChange: Emitted after animation ends
Slots
default: Drawer contentheader: Custom header contenttitle: Custom title contentfooter: Custom footer contentcloseIcon: Custom close icon </rewritten_file>