Drawer
A Duostrap edge-attached modal drawer featuring classic modal chrome, scrollable content, and snap points.
Duostrap Drawer brings classic 6px-rounded modal box chrome (ruled header, right-aligned muted footer, and beveled buttons) to an edge-attached drawer supporting all four sides, internal scrolling, and draggable snap points.
Preview
Section titled “Preview” Web Components React Vue Vue 2
Loading interactive preview… The article and source are ready to read. Interactive controls will appear here when ready.
<wc-duostrap-drawer-root a11y-label="Workspace preferences">
<wc-duostrap-drawer-trigger>
Open Drawer
</wc-duostrap-drawer-trigger>
<wc-duostrap-drawer-mask></wc-duostrap-drawer-mask>
<wc-duostrap-drawer-content side="bottom">
<wc-duostrap-drawer-handle></wc-duostrap-drawer-handle>
<wc-duostrap-drawer-header>
<wc-duostrap-drawer-title>
Workspace Preferences
</wc-duostrap-drawer-title>
<wc-duostrap-drawer-description>
Review default notification and digest rules for this
project.
</wc-duostrap-drawer-description>
</wc-duostrap-drawer-header>
<div class="p-[15px]">Daily digest: Enabled at 09:00 UTC</div>
<wc-duostrap-drawer-footer>
<wc-duostrap-drawer-close>Close</wc-duostrap-drawer-close>
</wc-duostrap-drawer-footer>
</wc-duostrap-drawer-content>
</wc-duostrap-drawer-root>Installation
Section titled “Installation”Available starting in 0.3.0-rc.1 and later releases (@proto.ui/prototypes-duostrap/drawer).
import { BootstrapDrawerRoot, BootstrapDrawerTrigger, BootstrapDrawerMask, BootstrapDrawerContent, BootstrapDrawerHandle, BootstrapDrawerHeader, BootstrapDrawerTitle, BootstrapDrawerDescription, BootstrapDrawerFooter, BootstrapDrawerClose,} from '../proto-ui/components/react';<BootstrapDrawerRoot> <BootstrapDrawerTrigger>Open Drawer</BootstrapDrawerTrigger> <BootstrapDrawerMask /> <BootstrapDrawerContent side="bottom"> <BootstrapDrawerHandle /> <BootstrapDrawerHeader> <BootstrapDrawerTitle>Workspace Preferences</BootstrapDrawerTitle> <BootstrapDrawerDescription> Review default notification and digest rules for this project. </BootstrapDrawerDescription> </BootstrapDrawerHeader> <div className="p-[15px]">{/* Body content */}</div> <BootstrapDrawerFooter> <BootstrapDrawerClose>Close</BootstrapDrawerClose> </BootstrapDrawerFooter> </BootstrapDrawerContent></BootstrapDrawerRoot>Composition
Section titled “Composition”DrawerRoot├── DrawerTrigger├── DrawerMask└── DrawerContent ├── DrawerHandle ├── DrawerHeader │ ├── DrawerTitle │ └── DrawerDescription └── DrawerFooter └── DrawerClose- Sizing and scrolling: Top and bottom drawers fit their content height up to the safe viewport region; left and right drawers default to a
20root-textcap. Wrap scrollable content inflex-1 overflow-y-autobetweenHeaderandFooter. - Extent bounds and snap points: Configure
minExtent,maxExtent, andsnapPointsdirectly onContent. Passing(0, 1]fractions enables explicit snap stops with keyboard arrow andHome/Endsupport onHandle. - Transitions:
Contentslides over 300ms andMaskfades over 150ms, automatically honoringprefers-reduced-motion.
Examples
Section titled “Examples”Position
Section titled “Position” Web Components React Vue Vue 2
Loading interactive preview… The article and source are ready to read. Interactive controls will appear here when ready.
<wc-duostrap-drawer-root a11y-label="Right Drawer">
<wc-duostrap-drawer-trigger>Right</wc-duostrap-drawer-trigger>
<wc-duostrap-drawer-mask></wc-duostrap-drawer-mask>
<wc-duostrap-drawer-content side="right">
<wc-duostrap-drawer-handle></wc-duostrap-drawer-handle>
<wc-duostrap-drawer-header>
<wc-duostrap-drawer-title>
Right Drawer
</wc-duostrap-drawer-title>
<wc-duostrap-drawer-description>
Slides in from the right edge.
</wc-duostrap-drawer-description>
</wc-duostrap-drawer-header>
<wc-duostrap-drawer-footer>
<wc-duostrap-drawer-close>Close</wc-duostrap-drawer-close>
</wc-duostrap-drawer-footer>
</wc-duostrap-drawer-content>
</wc-duostrap-drawer-root>Scrollable Content
Section titled “Scrollable Content” Web Components React Vue Vue 2
Loading interactive preview… The article and source are ready to read. Interactive controls will appear here when ready.
<wc-duostrap-drawer-root a11y-label="System activity log">
<wc-duostrap-drawer-trigger>
Scrollable Content
</wc-duostrap-drawer-trigger>
<wc-duostrap-drawer-mask></wc-duostrap-drawer-mask>
<wc-duostrap-drawer-content side="bottom">
<wc-duostrap-drawer-handle></wc-duostrap-drawer-handle>
<wc-duostrap-drawer-header>
<wc-duostrap-drawer-title>
System Activity Log
</wc-duostrap-drawer-title>
</wc-duostrap-drawer-header>
<div class="flex-1 overflow-y-auto p-[15px] space-y-2">
<!-- Scrollable log entries -->
</div>
<wc-duostrap-drawer-footer>
<wc-duostrap-drawer-close>Close</wc-duostrap-drawer-close>
</wc-duostrap-drawer-footer>
</wc-duostrap-drawer-content>
</wc-duostrap-drawer-root>Snap Points
Section titled “Snap Points” Web Components React Vue Vue 2
Loading interactive preview… The article and source are ready to read. Interactive controls will appear here when ready.
<wc-duostrap-drawer-root a11y-label="Snap points drawer">
<wc-duostrap-drawer-trigger>
Open Snap Drawer
</wc-duostrap-drawer-trigger>
<wc-duostrap-drawer-mask></wc-duostrap-drawer-mask>
<wc-duostrap-drawer-content
id="bootstrap-snap-content"
side="bottom"
>
<wc-duostrap-drawer-handle
a11y-label="Resize drawer height"
></wc-duostrap-drawer-handle>
<wc-duostrap-drawer-header>
<wc-duostrap-drawer-title>
Snap Points
</wc-duostrap-drawer-title>
</wc-duostrap-drawer-header>
<wc-duostrap-drawer-footer>
<wc-duostrap-drawer-close>Close</wc-duostrap-drawer-close>
</wc-duostrap-drawer-footer>
</wc-duostrap-drawer-content>
</wc-duostrap-drawer-root>
<script type="module">
import { setElementProps } from '@proto.ui/adapter-web-component';
setElementProps(
document.querySelector('#bootstrap-snap-content'),
{
side: 'bottom',
snapPoints: [0.5, 1],
defaultSnapPoint: 0.5,
}
);
</script>Custom Sizes & Locked Drag
Section titled “Custom Sizes & Locked Drag” Web Components React Vue Vue 2
Loading interactive preview… The article and source are ready to read. Interactive controls will appear here when ready.
<wc-duostrap-drawer-root a11y-label="Custom sized drawer">
<wc-duostrap-drawer-trigger>
Custom Size & Locked Drag
</wc-duostrap-drawer-trigger>
<wc-duostrap-drawer-mask></wc-duostrap-drawer-mask>
<wc-duostrap-drawer-content
id="bootstrap-sized-content"
side="right"
>
<wc-duostrap-drawer-header>
<wc-duostrap-drawer-title>
Inspector Panel
</wc-duostrap-drawer-title>
</wc-duostrap-drawer-header>
<wc-duostrap-drawer-footer>
<wc-duostrap-drawer-close>Close</wc-duostrap-drawer-close>
</wc-duostrap-drawer-footer>
</wc-duostrap-drawer-content>
</wc-duostrap-drawer-root>
<script type="module">
import { setElementProps } from '@proto.ui/adapter-web-component';
setElementProps(
document.querySelector('#bootstrap-sized-content'),
{
side: 'right',
maxExtent: { unit: 'logical', value: 420 },
dragDismissible: false,
}
);
</script>Pass open for controlled mode and subscribe to openChange. Exposes openDrawer(), close(), and toggle().
| Prop | Type | Default |
|---|---|---|
open | boolean | — |
defaultOpen | boolean | false |
disabled | boolean | false |
a11yLabel | string | '' |
Content
Section titled “Content”Exposes open, snapPoint, dragging, dragProgress, offsetPercentage, extentValid, requestSnapPoint(), and snapPointChange.
| Prop | Type | Default | Description |
|---|---|---|---|
side | 'top' 'right' 'bottom' 'left' | 'bottom' | — |
snapPoints | number[] | — | — |
snapPoint | number | — | — |
defaultSnapPoint | number | — | — |
minExtent | AvailableLayoutLength | { unit: 'logical', value: 0 } | — |
maxExtent | AvailableLayoutLength | by side | vertical { unit: 'available', value: 1 } / horizontal { unit: 'root-text', value: 20 } |
dragDismissible | boolean | true | — |
dragDismissThreshold | number | 0.25 | — |
enterDuration | number | 300 | — |
leaveDuration | number | 300 | — |
Mask / Handle / Trigger / Close
Section titled “Mask / Handle / Trigger / Close”| Prop | Type | Default |
|---|---|---|
Mask.passthrough | boolean | false |
Mask.enterDuration / leaveDuration | number | 150 |
Handle.disabled | boolean | false |
Handle.a11yLabel | string | 'Resize drawer' |
Trigger / Close.disabled | boolean | false |
Header, Footer, Title, and Description declare no additional props.