Props
| Name | Description |
|---|---|
defaultData Type: Record<string, any> | What The fresh copy a create gets as |
description Type: string | One short line under the title, muted (the shadcn |
draggable Type: booleanDefaultfalse | Drag-to-dismiss: a ~50px swipe toward the exit edge (also from the body once it is scrolled to its edge), with a grab handle as the cue. A gesture that starts inside Dragging about 50px toward the edge dismisses; a shorter drag springs back. On a top or bottom sheet the gesture hands off to native scrolling first, so scrolling a long body never closes it. See example |
eager Type: booleanDefaultfalse | Keep the body mounted while closed, from before the first opening. Without it the body mounts per opening and unmounts after The body renders lazily otherwise — nothing inside exists until the first open, which is what a test or a measurement runs into. See example |
focusTarget Type: string | CSS selector of the element to focus after opening. Defaults to the first tabbable element. Chooses where focus starts, never whether it is contained: |
fullscreen Type: boolean | "mobile" | Display the offcanvas fullscreen. Use Covers the whole viewport, edge to edge, unlike the dialog. |
hideClose Type: booleanDefaultfalse | Hides the default close (×) button in the header (e.g. for a Inverted from v2's |
id Type: string | Names the panel for One panel per id: it is also the DOM id. Many rows open the same panel with their own |
modelValue Type: booleanDefaultfalse | Used by v-model to open / close the panel. A panel with no |
navigation Type: booleanDefaultfalse | Syncs the open state with the URL: opening writes Writes |
persistent Type: booleanDefaultfalse | Blocks closing by an outside click, Escape or drag-to-dismiss. The header close (×) STILL closes a persistent drawer, the documented escape hatch: add Blocks the backdrop, Escape and the drag. The × still closes — that is the escape hatch — so pair it with |
preventClose Type: booleanDefaultundefined (follows a saving form inside) | Refuses every user close (backdrop, Escape, drag, the ✕, the slots' Refuses every user close, the drag and the slots' |
pt Type: PtMap<BbOffCanvasPtPart, BbOffCanvasPtState> | Passthrough, object form: the same keys as the |
pt:<part> Type: PtValue | Passthrough, attribute form: one attribute per part, |
queryKey Type: stringDefault"offcanvas" | The query key |
replace Type: booleanDefaultfalse | With |
side Type: Responsive<"left" | "top" | "bottom" | "right">Default"left" | Which viewport edge the offcanvas docks to (and slides in from). Also a per-breakpoint map (e.g. Called |
size Type: Responsive<OffCanvasSize>Default"sm" | The panel's extent along its axis: a left/right panel's width (shrinks with a narrower viewport) or a top/bottom one's height (capped at the viewport). A preset The extent along the panel's own axis, not a width: the same |
snap Type: BbSnapPoint | The snap stop the sheet rests at, written as one of the |
snapPoints Type: BbSnapPoint[] | Heights a draggable bottom sheet rests at, smallest first: a fraction of the screen ( A draggable |
stack Type: string | Name of the stack this drawer belongs to. Drawers sharing the same Panels sharing a name step back and leave a peeking band — the opposite of |
stackGap Type: numberDefault60 | Pixels each stacked parent drawer shifts inward when a child opens on top, leaving a peeking band of the parent visible. How much of the parent stays visible behind a child. Every open panel dims the one beneath it and only the bottom one blurs; set |
title Type: string | Title text announced to assistive technologies. If omitted, no header is rendered and accessibility must be handled manually. The accessible name, not just a heading: it wires |
transitionDuration Type: numberDefault250 | Controls the duration of the open and close animations. Times both the slide and when |
v-model
Values kept in sync through v-model.
| Name | Description |
|---|---|
modelValue Type: boolean | For a panel your state opens; a button opens one by |
snap Type: BbSnapPoint |
Events
| Name | Description |
|---|---|
hide Type: (result: BbDialogResult): void | Emitted as soon as the panel starts to close (model becomes false), with the opening's result: the same object its promise settles with, Fires as the close starts, with the opening's result, a swipe included: |
show Type: (): void | Emitted as soon as the user triggers the open action (model becomes true). Fires as the panel starts to open, before the slide, with the opening's |
shown Type: (): void | Emitted once the open transition has run (symmetric with |
update:modelValue Type: (value: boolean): void | Emitted with the new value whenever |
update:snap Type: (value: BbSnapPoint | undefined): void | Emitted with the new value whenever |
Slots
The listed properties are the ones exposed to the slot scope.
| Name | Description |
|---|---|
default Type: BbOffCanvasDefaultSlotProps | Primary body content of the off-canvas panel, rendered in the scrollable body area. The only region that scrolls, and on a draggable top or bottom panel it is also what absorbs a drag until it reaches its own edge. See example |
description Type: BbOffCanvasDescriptionSlotProps | Replaces the description text under the title. Renders the header even when |
footer Type: BbOffCanvasFooterSlotProps | Content rendered in the panel footer, below the body area. Typically used for action buttons. Stays pinned while the body scrolls, and lays its actions out in a row at the end (wrapping on a narrow sheet); |
header Type: BbOffCanvasHeaderSlotProps | Replaces the entire off-canvas header section (title + close button). Maintains accessibility wiring via the provided props. Providing it renders a header even with no |
title Type: BbOffCanvasTitleSlotProps | Replaces the default title text inside the header. Remains linked to the panel through |
Renamed and removed
Names from v2 and from earlier 3.0 betas that no longer work, and what to write instead.
compactremovedfails silentlydirectionsidefails silentlyshowClosehideClosefails silently