Skip to content

Drawer โ€‹

A side-anchored overlay panel that slides in from any of the four edges. Use it for detail views, filter panels, or contextual forms that don't deserve a full route. Bind open (or use the model-value alias) to control visibility, listen to mno-toggle for state changes, and pick the slide direction with position. Toggle Vue / CSS to switch the live demo and source together.

Basic โ€‹

Default right-side drawer with a header, body, and close button.

Vue SFC

Positions โ€‹

Slide in from left, right, top, or bottom.

Vue SFC

Stacked โ€‹

Set stackable to let drawers stack โ€” open a drawer from inside another, any depth. Each new drawer sits above the previous, only one backdrop dims the screen, and Esc / overlay-click affect only the topmost. Without stackable a drawer is exclusive: opening one closes any other open drawer.

Vue SFC

Z-index โ€‹

By default the drawer takes its stacking level from mono's shared popup stack, so the newest layer is always on top. Set z-index to pin it instead โ€” for sitting above (or below) something the host app already positions, like a sticky header or a third-party widget. The value is the overlay's level; the panel renders one above it. Accepts z-index="1500", :z-index="1500" and :zIndex="1500".

Vue SFC

Sizes โ€‹

size sets the content scale โ€” title type, body type, padding and the close icon โ€” across xs, sm, md (default), lg, xl and xxl. The panel keeps the same width at every step.

Changed

size used to be a dimension preset (sm 280px โ€ฆ full 100vw) and only partly affected typography. Use width / height for the panel measure; size="full" is now width="100%" (left/right) or height="100%" (top/bottom).

Vue SFC

Width & height โ€‹

Set width on a left/right drawer, or height on a top/bottom one โ€” the other axis is pinned to the viewport edge by position. Each accepts a CSS length ("32rem", "60%", "100vw") or a number, read as px.

They are applied as --mono-drawer-width / --mono-drawer-height, the same channel the resize handle writes to, so resizeable keeps working on top of them.

Vue SFC

Auto full-screen โ€‹

Set auto-fullscreen and the drawer fills the screen on small viewports. It defaults to sm (under 640px); pass md, lg, xl or 2xl to move the boundary. The drawer keeps its position, and a resizeable one hides its handle while full-screen.

Scroll lock โ€‹

While open, a drawer locks page scroll โ€” lock-scroll, default true. Opt out with :lock-scroll="false" when the page behind should stay scrollable.

vue
<mono-drawer v-model="open" :lock-scroll="false" />

The lock is shared, not per-instance: overlapping overlays (a modal opened from a drawer, stacked modals, a sidebar) all draw on one lock, so scroll is released only when the last one that wanted it closes. mono-sidebar takes the same prop.

Resizable โ€‹

Set resizeable to let users resize the drawer by dragging the handle on the panel's inner edge โ€” width for left/right drawers, height for top/bottom. The size is clamped between a minimum and the viewport.

Vue SFC

Colors โ€‹

Six accent colors threaded through the head and scrollbar.

Vue SFC

Custom header and footer content via slots.

Vue SFC

Persistent โ€‹

Overlay click and Escape are ignored โ€” only the close button or programmatic hide() will dismiss.

Vue SFC

No overlay โ€‹

Side panel without a backdrop โ€” page behind stays interactive.

Vue SFC

Event log โ€‹

Live log of mno-toggle events with source (overlay / close / escape / manual).

Vue SFC

Customized โ€‹

Per-element overrides via cssClass (Vue) or utility classes (CSS).

Vue SFC

CSS Variables โ€‹

Vue SFC

Every drawer is themed through --mono-drawer-* custom properties. Because the panel renders through a <body> portal, --mono-drawer-* set inline on the <mono-drawer> element are forwarded to the portal (per-instance theming); you can also set them on :root, and they pierce the shadow-DOM boundary. The size/position/color props set presets, but an explicit --mono-drawer-* override always wins. To re-skin globally, set the underlying --theme-* tokens.

VariableDefaultControls
--mono-drawer-accent--theme-primaryHeader/title tint, close, resizer, scrollbar (set by color)
--mono-drawer-bg--theme-surfacePanel background
--mono-drawer-text--theme-textPanel text color
--mono-drawer-border--theme-borderPanel + head/foot border
--mono-drawer-head-bgaccent 7%Header background
--mono-drawer-foot-bgaccent 4%Footer background
--mono-drawer-overlay-bgrgba(15,25,45,.42)Backdrop scrim color
--mono-drawer-width420pxPanel width for left/right โ€” not set by size; use the width prop
--mono-drawer-height50vhPanel height for top/bottom โ€” not set by size; use the height prop
--mono-drawer-shadow0 12px 48px โ€ฆPanel shadow
--mono-drawer-pad-x1.4remSection horizontal padding (set by size)
--mono-drawer-z9990Base z-index (the popup stack overwrites this per level; prefer the z-index prop, and note an inline var still wins over it)

Types โ€‹

Importimport { DrawerProps } from 'mono-helper'
PropValueDefaultDescription
modelValuebooleanโ€”Two-way bound open state of the drawer.
position'left' | 'right' | 'top' | 'bottom'โ€”Edge the drawer slides in from.
size'xs' | 'sm' | 'md' | 'lg' | 'xl' | 'xxl'โ€”Sizing scale of the drawer panel.
color'primary' | 'secondary' | 'success' | 'danger' | 'warning' | 'info'โ€”Color theme applied to the drawer.
titlestringโ€”Heading text shown in the drawer header.
dismissiblebooleanโ€”Shows a close button and allows dismissal.
persistentbooleanโ€”Prevents closing via overlay click or escape.
overlaybooleanโ€”Renders a backdrop overlay behind the panel.
closeOnEscapebooleanโ€”Closes the drawer when the Escape key is pressed.
closeOnOverlaybooleanโ€”Closes the drawer when the overlay is clicked.
lockScrollbooleanโ€”Locks page scroll while the drawer is open (default `true`). The lock is shared across overlapping overlays, so it lifts only when the last one closes.
autoFullscreen'sm' | 'md' | 'lg' | 'xl' | '2xl' | booleanโ€”Fill the screen at a breakpoint and below (default `false`). `auto-fullscreen` on its own means Tailwind's `sm` (< 640px); a token moves the boundary, so `auto-fullscreen="lg"` covers everything `lg:` does not match (< 1024px).
resizeablebooleanโ€”Allow resizing the drawer by dragging a handle on the panel's inner edge.
stackablebooleanโ€”Allow this drawer to stack on top of others. When false (default) it is exclusive โ€” opening it closes any other open drawers.
widthstring | numberโ€”Panel dimensions. Each accepts a CSS length string (`"12rem"`, `"80%"`, `"100vw"`) or a number / numeric string (interpreted as px). `width` applies to left/right drawers, `height` to top/bottom ones โ€” the other axis is pinned to the viewport edge by `position`. `width="100%"` (or `height="100%"`) replaces the old `size="full"`.
heightstring | numberโ€”โ€”
zIndexstring | numberโ€”Pin the drawer to an explicit stacking level. Unset (the default) lets the shared popup stack assign one so the newest layer is always on top. The value is the overlay's `z-index`; the panel sits one above it.
cssClassDrawerCssClassโ€”Per-element class overrides for internal parts.
cssClassNamestringโ€”Extra class name applied to the drawer root.