i-drawer-vue
A reusable Drawer component for Vue 3
379
| Install | |
|---|---|
npm install i-drawer-vue |
|
| Latest Version: | 1.0.5 |
| Vue: | 3 |
| License: | MIT |
| Last Updated: | Oct 16, 2026 |
| Links: | npm |
Maintainer: ilham_gurbanly
Vue Drawer Package by Ilham Gurbanly.
Drawer Package for Vue 3.
Installation
$ npm install i-drawer-vue
Usage
main.ts: If you wish use it as plugin, import and use it in main.ts file. And do not forget to import css file. This is global import.
import { createApp } from 'vue'
import './style.css'
import App from './App.vue'
import IDrawer from "i-drawer-vue";
import "i-drawer-vue/dist/style.css";
createApp(App).use(IDrawer).mount('#app');
Local import as package in components:
<script setup lang="ts">
import { reactive, ref } from "vue";
import { IDrawer, type IDrawerOptions } from "i-drawer-vue";
import "i-drawer-vue/dist/style.css";
</script>
App.vue:
<script setup lang="ts">
import { reactive, ref } from 'vue';
import { IDrawer, type IDrawerOptions } from 'i-drawer-vue';
import "i-drawer-vue/dist/style.css";
const show = ref<boolean>(false);
const options = reactive<IDrawerOptions>({
closeableMask: true,
mask: true,
contentColor: 'white',
placement: 'top',
renderOnShow: false,
maskColor: 'rgba(0, 0, 0, .5)',
hideOnDesktop: false,
resizable: true,
closeOnEsc: true,
padding: 20
})
</script>
<template>
<IDrawer
:show="show"
:options="options"
@on-close="show = false"
@on-resize="(data) => { console.log('new-size', data) }"
@on-resize-start="() => { console.log('resizing_started'); }"
@on-resize-end="() => { console.log('resizing_ended'); }"
>
<template #header>
<h2 class="profile-name">Emily Smith</h2>
<p class="profile-desc">Front-End Developer</p>
</template>
<template #body>
<p class="profile-txt">Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has
been the industry's standard dummy text ever since 1966, when designers at Letraset and James Mosley, the
librarian at St Bride Printing Library in London, took a 1914 Cicero translation and scrambled it to make dummy
text for Letraset's Body Type sheets. It has survived not only many decades, but also the leap into electronic
typesetting, remaining essentially unchanged. It was popularised thanks to these sheets and more recently with
desktop publishing software like Aldus PageMaker and Microsoft Word including versions of Lorem Ipsum.</p>
</template>
<template #footer>
<div class="profile-footer">
<button class="btn btn-primary">Follow</button>
<button class="btn btn-primary">Share Profile</button>
</div>
</template>
</IDrawer>
</template>
Props and named slots
- show: boolean (Required) - controls whether the drawer is visible.
- onClose: event (Required) - Emitted when the user requests to close the drawer (e.g. by pressing the ESC key, clicking the mask, or clicking the close icon). The parent is responsible for setting show to false.
- onResizeStart: event (Optional) - Emitted when the user starts resize the drawer.
- onResizeEnd: event (Optional) - Emitted when resizing gets stopped.
- onResize: event(size) (Optional) - Emitted when the user resizes, and returns size as props.
- options: options object (Optional)
- closeableCloseBtn: boolean (Optional) - whether close button can close the drawer, default value is true.
- showCloseBtn: boolean (Optional) - whether to show close button, default value is true.
- zIndex: number (Optional) - z-index value of drawer, default value is 9999999.
- closeOnEsc: boolean (Optional) - whether ESC button can close the drawer, default value is true.
- maskColor: string (Optional) - mask color of drawer, default value is rgba(0, 0, 0, .5).
- contentColor: string (Optional) - content background color of drawer, default value is white.
- closeableMask: boolean (Optional) - whether clicking on mask can close the drawer, default value is true.
- padding: number (Optional) - padding of the drawer content, default value is 20.
- hideOnDesktop: boolean (Optional) - whether hide drawer on desktop screens, default value is false.
- renderOnShow: boolean (Optional) - whether render drawer if show is true, default value is false, it hides it via CSS by default.
- resizable: boolean (Optional) - whether drawer content is resizable, default value is true.
- placement: 'top' | 'right' | 'bottom' | 'left' (Optional) - placement of drawer content, default value is 'right'.
- minSize: string | null (Optional) - minimum size of drawer content, due to placement position it can be height or width, default value is '10%'.
- maxSize: string | null (Optional) - maximum size of drawer content, due to placement position it can be height or width, default value is '95%'.
- size: string (Optional) - size of content. Important note here, if you define size manually, then to resize you should use onResize event to change your content size state, otherwise it will not work. If size is not defined it will work fine on resize, so you do not need listen onResize event to resize content. Default value is '400px'.
- header - named slot for providing custom header content.
- body - named slot for providing custom body content.
- footer - named slot for providing custom footer content.
Related Packages
@0k/vue-side-panel
Shared Vue 3 side-panel chrome and interaction controller for responsive docked...
381
0
Version History
| Version | Released | Vue | License |
|---|---|---|---|
| 1.0.5 | ^3.5.42 | MIT | |
| 1.0.4 | ^3.5.42 | ||
| 1.0.0 | ^3.5.42 |
Pre-releases (1)
| Version | Released | License |
|---|---|---|
| 0.0.0-stage |