Skip to content
coatx
Esc
↑↓navigate↵open⌘Jpreview
On this page

Drawer

Mobile-native bottom, top, left, and right drawer recipes with drag handle and safe-area padding.

Usage

import {
  Drawer,
  DrawerBackdrop,
  DrawerContent,
  DrawerDescription,
  DrawerHandle,
  DrawerTitle,
  DrawerTrigger,
} from "@ilha/ui-sdk/drawer";
import { button } from "coatx/button";
import {
  drawerBackdrop,
  drawerContent,
  drawerDescription,
  drawerHandle,
  drawerHeader,
  drawerTitle,
} from "coatx/drawer";

export const MobileDrawer = () => (
  <Drawer side="bottom">
    <DrawerTrigger {...button({ variant: "outline" })}>Open</DrawerTrigger>
    <DrawerBackdrop {...drawerBackdrop()} />
    <DrawerContent {...drawerContent({ direction: "bottom" })}>
      <DrawerHandle aria-label="Drag handle" {...drawerHandle()} />
      <div {...drawerHeader()}>
        <DrawerTitle {...drawerTitle()}>Move goal</DrawerTitle>
        <DrawerDescription {...drawerDescription()}>
          Set your daily target.
        </DrawerDescription>
      </div>
    </DrawerContent>
  </Drawer>
);

Exports (coatx/drawer)

Export Description
drawerBackdrop(options?) Dimmed fixed overlay backdrop
drawerContent(options?) Sliding drawer panel (direction: "bottom", "top", "left", "right")
drawerHandle(options?) Centered pill drag handle
drawerHeader(options?) Centered title & description stack
drawerFooter(options?) Bottom-aligned action stack
drawerTitle(options?) Drawer heading
drawerDescription(options?) Muted supporting description
drawerStyles Compiled StyleX style map

Was this page helpful?