Sidenav

Create overlay, push, or fixed side drawers with canonical vd-sidenav-* variants.

VdSidenav Component
Composable Sidenav Demo
Basic Structure
Variants
ClassPurpose
.vd-sidenav-rightOpen from right side
.vd-sidenav-pushPush content on desktop
.vd-sidenav-fixedPersistent desktop sidebar
.vd-sidenav-smSmall width (233px)
.vd-sidenav-lgLarge width (377px)

Runtime state classes: .is-open on sidenav and .body-sidenav-open on body.

CSS Variables
VariableDefault
--vd-sidenav-width233px
--vd-sidenav-width-lg377px
--vd-sidenav-bgvar(--vd-color-white)
--vd-sidenav-overlay-bgrgba(0, 0, 0, 0.35)
--vd-sidenav-z-index1040
--vd-sidenav-overlay-z-index1030
--vd-sidenav-transitiontransform var(--vd-transition-duration-slow) var(--vd-transition-ease)
API Reference

Wiring

import { ref } from 'vue';
import { useSidenav } from "@vanduo-oss/vd3";

const root = ref<HTMLElement | null>(null);
useSidenav(root);   // wires [data-sidenav-toggle] triggers; cleanup on unmount

VdSidenav Component API

Prop / Event / SlotDescription
v-model (modelValue)boolean — controls open/closed drawer visibility.
:placement"left" (default) | "right" | "top" | "bottom".
:titlestring — optional header heading and accessible aria-label.
:closeOnBackdropboolean (default true) — close when clicking the overlay backdrop.
:closeOnEscboolean (default true) — close when pressing Escape.
:animatedboolean (default true) — smooth sliding transition using Fibonacci timing and golden easing.
@closeEmitted whenever the drawer closes.
#header / default / #footerNamed slots for custom header content, scrollable body content, and footer actions.

CSS Classes & Data Attributes

Class Name / AttributeDescriptionType
.vd-sidenavBase container for the off-canvas side drawer.Component
.vd-sidenav-headerHeader area containing the title and close button.Layout
.vd-sidenav-titleTypography class for the sidenav header text.Element
.vd-sidenav-closeButton to explicitly close the sidenav.Action
.vd-sidenav-bodyScrollable content container for the main drawer area.Layout
.vd-sidenav-navWrapper for an unordered list of navigation items.Layout
.vd-sidenav-itemIndividual list item. Add .active for current state.Component
.vd-sidenav-linkClickable anchor element within a sidenav item.Element
.vd-sidenav-[variant]Modifiers defining behavior/positioning (-right, -push, -fixed, -sm, -lg).Modifier
data-sidenav-toggle="#id"Attribute placed on any trigger element (like a button) to open/close the targeted sidenav.Attribute
Accessibility
  • VdSidenav renders a semantic <aside> with :aria-label="title || 'Side navigation'" and a close button labeled aria-label="Close".
  • Pressing Escape (when closeOnEsc is enabled) or clicking the backdrop (when closeOnBackdrop is enabled) closes the drawer and releases body scroll lock.
  • Composable useSidenav triggers receive aria-controls and an aria-expanded that stays in sync with every open/close path (toggle, close button, backdrop, Escape). The drawer itself does not trap focus; reach for VdOffcanvas when you need modal dialog behavior.