bx

Drawer

A drawer component that slides in from the edge of the screen.

tsx
<Drawer>
  <DrawerTrigger for="confirm"><Button variant="outline">Open</Button></DrawerTrigger>
  <DrawerContent id="confirm">
    <div className="p-4">Contenu</div>
  </DrawerContent>
</Drawer>

Drawer — bottom sheet mobile-friendly avec drag handle. Contrairement au Sheet (desktop, slide depuis un bord), le Drawer est optimisé pour mobile : il monte depuis le bas et se referme par un swipe down.

Pour un formulaire ou un flow d'action ciblé mobile, le Drawer est plus naturel qu'un Dialog qui prend tout l'écran ou un Sheet qui glisse depuis le bord.

Installation

Terminal
$ bext ui add drawer

Usage

tsx
import { Drawer, DrawerTrigger, DrawerContent } from "@bext-stack/ui/primitives"

<Drawer>
  <DrawerTrigger for="mobile-menu">
    <Button variant="outline">Open</Button>
  </DrawerTrigger>
  <DrawerContent id="mobile-menu">
    <div className="p-4">Contenu mobile-friendly</div>
  </DrawerContent>
</Drawer>

Anatomy

<Drawer>
  ├── <DrawerTrigger for="drawer-id">
  │   └── <Button>Open</Button>
  └── <DrawerContent id="drawer-id">
      └── ...contenu libre...

API Reference

DrawerTrigger

Prop Type Default Description
for string Match l'id du Content.

DrawerContent

Prop Type Default Description
id string Match Trigger.for.
className string Défaut : fixed inset-x-0 bottom-0, bg-background rounded-t-lg border-t, avec drag handle en haut.

Data Attributes

Attributs qu'on peut cibler en CSS custom pour override le style par état.

Attribute On Values Description
data-ui="toggle-pop" Trigger data-target="#id" Cliquer ouvre.
data-overlay Content hidden Modal.

Keyboard

Key Action
Escape Ferme.

Accessibility

Content porte role="dialog". Sur mobile, le drag handle est un affordance visuel mais pas nécessaire — Escape et le clic backdrop ferment aussi.

Try it live
Open in play

Edit this component live in the bext playground. The PRISM + signals version is the bext-native idiom — fine-grained reactivity, no virtual DOM.

src/app/page.tsx 2 files · signals · runs in your browser
Pure PRISM + real bext signals — fine-grained, no re-render.