For vue2 projects, use @94ai/common-ui
LLMs.md

Drawer ​

An Element Plus drawer with asynchronous confirmation, cancellation, custom footer and vertical tabs. Supports Chalk/OEM themes.

Basic usage ​

Loading example…
Basic usage
Loading example…
Custom title
Loading example…
Custom footer

Custom tabs ​

Loading example…
Custom tabs
Loading example…
Hide footer buttons

Installation ​

ts
import NfDrawer from '@94ai-plus/nf-drawer'
import 'element-plus/dist/index.css'
import '@94ai-plus/nf-theme-chalk/nf-drawer.css'
app.use(NfDrawer)

Props ​

AttributeDescriptionTypeAccepted valuesDefault
showConfirmButtonWhether to show the confirm buttonboolean—true
showCancelButtonWhether to show the cancel buttonboolean—true
cancelButtonTextCancel button textstring—Current locale
confirmButtonTextConfirm button textstring—Current locale
currentTabCurrent tab name; supports v-model:current-tab; invalid values fall back to the first tabstring—undefined
tabsTab data: name is the tab name, slot names its content slotITabItem[] / DrawerTabItem[]—undefined
modelValueVisibility with v-model; takes precedence over visibleboolean—false
visibleVisibility with v-model:visibleboolean—false
titleTitlestring—''
customClassCustom class namestring—''
wrapperClosableWhether clicking the backdrop closes Drawerboolean—false
closeOnClickModalBackdrop closing; when explicit, overrides wrapperClosableboolean—wrapperClosable
closeOnPressEscapeWhether Escape closes Drawerboolean—false
directionDrawer opening directionstringrtl / ltr / ttb / bttrtl
sizeDrawer size: width for horizontal, height for verticalstring / number—30%
beforeCloseBefore-close callback; done() continues closing; successful confirmation bypasses it(done: (cancel?: boolean) => void) => void——
withHeader / showClose / appendTo / appendToBody / destroyOnClose / resizable / modal / lockScroll / openDelay / closeDelay / zIndex / headerClass / bodyClass / footerClassForwards the same Element Plus Drawer properties, defaults and behaviorElement Plus Drawer—Element Plus Drawer

Events ​

EventDescriptionPayload
cancelDrawer cancel button callbackevent: MouseEvent
confirmDrawer confirm callback; done() closes, error() only stops loadingdone: () => void, error: () => void
changeTabTab change callback, receiving the current tab namename: string
update:modelValueEmitted when visibility changesvalue: boolean
update:visibleEmitted when visibility changesvalue: boolean
update:currentTabSynchronizes the active tab; undefined for an empty listvalue: string / undefined
open / opened / close / closed / openAutoFocus / closeAutoFocusForwards Element Plus Drawer opening, closing and autofocus events—
resize-start / resize / resize-endEmitted when resizing starts, moves and endsevent: MouseEvent, size: number

Slots ​

SlotDescriptionPayload
defaultDrawer content—
titleDrawer title contentclose, titleId, titleClass
headerDrawer header content; takes precedence over the title slotclose, titleId, titleClass
footerDrawer footer content; hidden when both buttons are hidden—
tabs[].slotTab content named by tabs[].slot—

Types ​

ts
import type { DrawerProps, DrawerTabItem, ITabItem, DrawerInstance } from '@94ai-plus/nf-drawer'
// DrawerTabItem: { name: string; slot: string }; ITabItem = DrawerTabItem
// DrawerInstance: closeDrawer(), handleClose(); both run beforeClose

Migration ​

Replace Vue 2 :visible.sync with v-model:visible. wrapperClosable maps to closeOnClickModal (the latter wins); customClass is merged onto the panel. The legacy title slot maps to header; otherwise the title prop renders normally. Hiding both buttons hides the entire footer, including custom content. Confirmation callbacks are single-use and invalidated on close/reopen/unmount. SSR renders a placeholder until mounted.