Component
Drawer
A modal panel anchored to an edge — the narrow-viewport form of a sidebar.
import { Drawer } from '@loidolt/theme-svelte';
Example
Notes
--ldt-drawer-sizeis the measure across the anchored edge, always capped so the scrim stays reachable.- Same primitive as
Dialog: focus is trapped, Escape closes, the page behind is inert. triggerVariant/triggerSizepick the trigger button clothes; an explicittriggerClasswins wholesale.- The panel insets its content from the safe area on the three screen edges it touches.
Props
Generated from the component source, so it cannot drift from the implementation.
| Prop | Type | Default | Notes |
|---|---|---|---|
children required | Snippet | — | |
title required | string | — | |
class | string | — | class lands on the portaled Content element. |
closeLabel | string | 'Close' | |
description | string | — | |
footer | Snippet | — | |
headingLevel | HeadingLevel | 2 | |
onOpenChange | (open: boolean) => void | — | |
open bindable | boolean | false | |
overlayClass | string | — | |
ref bindable | HTMLElement | null | null | |
showClose | boolean | true | |
side | 'left' | 'right' | 'top' | 'bottom' | 'left' | Edge the panel is anchored to. left/right size by width, top/bottom by height. |
trigger | Snippet | — | Trigger contents, rendered inside a button styled with triggerClass. |
triggerChild | Snippet<[TriggerChildProps]> | — | Full control of the trigger element — receives the props Bits needs on it. |
triggerClass | string | — | |
triggerSize | ControlSize | — | |
triggerVariant | ActionVariant | — | Button variant for the default trigger. An explicit triggerClass wins wholesale. |
Plus the attributes of Omit<DialogContentProps, 'children' | 'class' | 'child'>, forwarded to the root element.