Drawer
A bottom sheet with a drag handle and drag-to-dismiss.
Preview
Move goal
Set your daily activity goal. Drag the handle down to dismiss.
Controls
Device view renders in an isolated frame so real responsive breakpoints apply. Switch to Full for overflowing popovers.
Installation
php artisan ui:add drawer
Behavior layer (Alpine)
This component installs a self-registering Alpine module to
resources/js/ui/drawer.js. Import the behavior layer once
from your bundle so it loads (it hooks alpine:init):
import './drawer.js';
Registry contract
Install confidence
php artisan ui:add drawer
writes only the generated targets below. The CLI validates each file hash before writing and
prompts before replacing local changes unless --force is used.
- Version
- 1.1.0
- License
- open
- Stability
- stable
- Contract
- v2
- Foundation
- ≥ 1.0.0
| Type | Generated target |
|---|---|
| blade | resources/views/components/ui/drawer.blade.php |
| blade | resources/views/components/ui/drawer/trigger.blade.php |
| blade | resources/views/components/ui/drawer/content.blade.php |
| blade | resources/views/components/ui/drawer/header.blade.php |
| blade | resources/views/components/ui/drawer/title.blade.php |
| blade | resources/views/components/ui/drawer/description.blade.php |
| blade | resources/views/components/ui/drawer/footer.blade.php |
| blade | resources/views/components/ui/drawer/handle.blade.php |
| js | resources/js/ui/drawer.js |
Registry dependencies
None.
Package dependencies
composer: jml/brok:^1.0
npm: alpinejs
Guidance
Focused overlayHandle a short focused interruption or blocking decision.
Use when
- Use for short, self-contained work that benefits from preserving page context, or for interruptions that truly deserve focused attention. Do not use for long forms, multi-step tasks, or broad comparison work that needs more room and less interruption.
- A mobile-first action or detail surface should enter from the bottom.
- Drag-to-dismiss is a useful, discoverable complement to explicit close controls.
Avoid when
- Use for side tasks, inspectors, or secondary controls that should coexist with the main canvas; avoid making it the primary flow.
- Desktop edge-aligned navigation or inspection is the primary use case; use sheet.
- The content is a small contextual disclosure; use popover.
- Task length
- short
- Interaction cost
- high
- Interruptiveness
- high
- Input precision
- none
- Mobile / touch risk
- high
- Accessibility risk
- high
- Needs background context
- Yes
- Comparison needed
- No
Preferred alternatives
- Inline content
- Drawer or dedicated page for longer tasks
Anti-patterns
- Long forms in dialogs
- Multi-step or comparison-heavy modal workflows
Anatomy
root
trigger
overlay
content
handle
header
title
description
footer
Theming hooks
drawer overlay
drawer content
drawer handle
Canonical examples
defaultscrollablewith-form
API
manifest knowledge + registry-derived coverageProps
No documented props. Pass normal Blade attributes through the component root.
Slots
default— Primary Blade slot rendered by the component.x-ui.drawer.trigger— Installed subcomponent from the registry item.x-ui.drawer.content— Installed subcomponent from the registry item.x-ui.drawer.header— Installed subcomponent from the registry item.x-ui.drawer.title— Installed subcomponent from the registry item.x-ui.drawer.description— Installed subcomponent from the registry item.x-ui.drawer.footer— Installed subcomponent from the registry item.x-ui.drawer.handle— Installed subcomponent from the registry item.
Data slots
drawer
drawer-content
drawer-description
drawer-footer
drawer-handle
drawer-header
drawer-overlay
drawer-portal
drawer-title
drawer-trigger
Capabilities
Behavior
- Supports pointer drag-to-dismiss while retaining Escape, focus trap, and focus restoration.
- Reduced-motion users receive non-animated state changes.
- Installs a JavaScript behavior module when the registry item includes resources/js/ui files.
- Declares registry capability flags: a11y, interactive, responsive, rtl, darkMode, localized.
Usage
<x-ui.drawer>
<x-ui.drawer.trigger class="inline-flex h-10 items-center justify-center rounded-md bg-primary px-4 text-sm font-medium text-primary-foreground transition-colors hover:bg-primary/90 focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background">
{{ __('Open drawer') }}
</x-ui.drawer.trigger>
<x-ui.drawer.content>
<x-ui.drawer.handle />
<x-ui.drawer.header>
<x-ui.drawer.title>{{ __('Move goal') }}</x-ui.drawer.title>
<x-ui.drawer.description>{{ __('Set your daily activity goal. Drag the handle down to dismiss.') }}</x-ui.drawer.description>
</x-ui.drawer.header>
<div class="mt-4 space-y-2">
<x-ui.label for="goal">{{ __('Daily goal') }}</x-ui.label>
<x-ui.input id="goal" value="350 cal" />
</div>
<x-ui.drawer.footer>
<button type="button" @click="hide()" class="inline-flex h-10 items-center justify-center rounded-md border border-border bg-background px-4 text-sm font-medium text-foreground transition-colors hover:bg-muted focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background">
{{ __('Close') }}
</button>
</x-ui.drawer.footer>
</x-ui.drawer.content>
</x-ui.drawer>
Accessibility & localization
data-slot
Keyboard focus-visible
Localized labels
- Never rely on the drag gesture as the only dismissal mechanism.
- Provide a title and an explicit action or close control.
- Uses semantic HTML and a stable
data-slotattribute for styling/scripting hooks. - Focus-visible rings use the
ringtoken so keyboard focus is always visible. - Disabled and invalid states are conveyed to assistive tech, not by color alone.
- Targets WCAG 2.2 AA; verify contrast in light, dark, admin and customer surfaces above.
- Labels go through
__()and the component uses logical properties (ms-*,text-start,start-*) so it mirrors correctly — flip the preview to RTL to confirm.
Source
The exact, editable file ui:add writes
into your app — copy it or own the whole thing. Previews
render this same code; there are no preview-only components.
Changelog
Current version: v1.1.0. See the site changelog for the full release history.