Drawer
A Brutalist edge-attached modal drawer with four sides, hard shadows, scrollable content, and snap points.
Brutalist Drawer slides a crisp 2px black-bordered, 5px-rounded modal panel from any of the four screen edges with content-fit or fractional sizing, scrollable long content, drag dismissal, and optional 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-brutalist-drawer-root a11y-label="Confirm deployment">
<wc-brutalist-drawer-trigger>
Open Drawer
</wc-brutalist-drawer-trigger>
<wc-brutalist-drawer-mask></wc-brutalist-drawer-mask>
<wc-brutalist-drawer-content side="bottom">
<wc-brutalist-drawer-handle
a11y-label="Resize drawer"
></wc-brutalist-drawer-handle>
<wc-brutalist-drawer-title>
Are you absolutely sure?
</wc-brutalist-drawer-title>
<wc-brutalist-drawer-description>
Publish the latest build to the staging environment.
</wc-brutalist-drawer-description>
<wc-brutalist-drawer-close>Cancel</wc-brutalist-drawer-close>
</wc-brutalist-drawer-content>
</wc-brutalist-drawer-root>Installation
Section titled “Installation”Available starting in 0.3.0-rc.1 and later releases (@proto.ui/prototypes-brutalist/drawer).
import { BrutalistDrawerRoot, BrutalistDrawerTrigger, BrutalistDrawerMask, BrutalistDrawerContent, BrutalistDrawerHandle, BrutalistDrawerHeader, BrutalistDrawerTitle, BrutalistDrawerDescription, BrutalistDrawerFooter, BrutalistDrawerClose,} from '../proto-ui/components/react';<BrutalistDrawerRoot> <BrutalistDrawerTrigger>Open Drawer</BrutalistDrawerTrigger> <BrutalistDrawerMask /> <BrutalistDrawerContent side="bottom"> <BrutalistDrawerHandle /> <BrutalistDrawerHeader> <BrutalistDrawerTitle>Are you absolutely sure?</BrutalistDrawerTitle> <BrutalistDrawerDescription> Publish the latest build to the staging environment. </BrutalistDrawerDescription> </BrutalistDrawerHeader> <BrutalistDrawerFooter> <BrutalistDrawerClose>Cancel</BrutalistDrawerClose> </BrutalistDrawerFooter> </BrutalistDrawerContent></BrutalistDrawerRoot>Composition & visual grammar
Section titled “Composition & visual grammar”DrawerRoot├── DrawerTrigger├── DrawerMask└── DrawerContent ├── DrawerHandle ├── DrawerHeader │ ├── DrawerTitle │ └── DrawerDescription └── DrawerFooter └── DrawerClose- Elevation and motion:
TriggerandCloserender raised4px 4pxhard shadows with+4px, +4pxpress snap.Contentapplies5px(rounded-base) rounding on its exposed edge with a 200ms slide transition, andMaskfades over 150ms. - Sizing and scrolling: Vertical drawers fit their content height up to available height minus 6 root-text units; horizontal drawers cap at 20 root-text units by default. Wrap scrollable body regions in
flex-1 overflow-y-auto. - Snap points and accessibility: Supplying a non-empty
snapPointsarray in(0, 1]upgradesHandleto a namedseparatorwith arrow-key andHome/Endresizing while preserving dark-mode contrast via semantic foreground tokens.
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-brutalist-drawer-root a11y-label="Right Drawer">
<wc-brutalist-drawer-trigger>Right</wc-brutalist-drawer-trigger>
<wc-brutalist-drawer-mask></wc-brutalist-drawer-mask>
<wc-brutalist-drawer-content side="right">
<wc-brutalist-drawer-handle></wc-brutalist-drawer-handle>
<wc-brutalist-drawer-title>
Right Drawer
</wc-brutalist-drawer-title>
<wc-brutalist-drawer-description>
Slides in from the right edge.
</wc-brutalist-drawer-description>
<wc-brutalist-drawer-close>Close</wc-brutalist-drawer-close>
</wc-brutalist-drawer-content>
</wc-brutalist-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-brutalist-drawer-root a11y-label="Activity log">
<wc-brutalist-drawer-trigger>
Scrollable Content
</wc-brutalist-drawer-trigger>
<wc-brutalist-drawer-mask></wc-brutalist-drawer-mask>
<wc-brutalist-drawer-content side="bottom">
<wc-brutalist-drawer-handle></wc-brutalist-drawer-handle>
<wc-brutalist-drawer-title>
Activity Log
</wc-brutalist-drawer-title>
<div class="flex-1 overflow-y-auto space-y-2">
<!-- Scrollable activity entries -->
</div>
<wc-brutalist-drawer-close>Close</wc-brutalist-drawer-close>
</wc-brutalist-drawer-content>
</wc-brutalist-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-brutalist-drawer-root a11y-label="Snap points drawer">
<wc-brutalist-drawer-trigger>
Open Snap Drawer
</wc-brutalist-drawer-trigger>
<wc-brutalist-drawer-mask></wc-brutalist-drawer-mask>
<wc-brutalist-drawer-content
id="brutalist-snap-content"
side="bottom"
>
<wc-brutalist-drawer-handle
a11y-label="Resize drawer height"
></wc-brutalist-drawer-handle>
<wc-brutalist-drawer-title>
Snap Points
</wc-brutalist-drawer-title>
<wc-brutalist-drawer-description>
Drag the handle or use Arrow Up / Down to change height.
</wc-brutalist-drawer-description>
<wc-brutalist-drawer-close>Close</wc-brutalist-drawer-close>
</wc-brutalist-drawer-content>
</wc-brutalist-drawer-root>
<script type="module">
import { setElementProps } from '@proto.ui/adapter-web-component';
setElementProps(
document.querySelector('#brutalist-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-brutalist-drawer-root a11y-label="Custom sized drawer">
<wc-brutalist-drawer-trigger>
Custom Size & Locked Drag
</wc-brutalist-drawer-trigger>
<wc-brutalist-drawer-mask></wc-brutalist-drawer-mask>
<wc-brutalist-drawer-content
id="brutalist-sized-content"
side="right"
>
<wc-brutalist-drawer-title>
Inspector Panel
</wc-brutalist-drawer-title>
<wc-brutalist-drawer-description>
Capped at 420px with drag dismissal disabled.
</wc-brutalist-drawer-description>
<wc-brutalist-drawer-close>Close</wc-brutalist-drawer-close>
</wc-brutalist-drawer-content>
</wc-brutalist-drawer-root>
<script type="module">
import { setElementProps } from '@proto.ui/adapter-web-component';
setElementProps(
document.querySelector('#brutalist-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-minus-root-text', value: 6 } / horizontal { unit: 'root-text', value: 20 } |
dragDismissible | boolean | true | — |
dragDismissThreshold | number | 0.25 | — |
enterDuration | number | 200 | — |
leaveDuration | number | 200 | — |
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.