Drawer

Drawer composes Base UI’s drawer primitives for panels that slide over the current screen.

import { Drawer } from "density-base-ui";

export default function DrawerExample() {
  return (
    <Drawer.Root>
      <Drawer.Trigger>Open drawer</Drawer.Trigger>
      <Drawer.Portal>
        <Drawer.Backdrop className="drawer-example-backdrop" />
        <Drawer.Popup className="drawer-example-popup">
          <Drawer.Content className="drawer-example-content">
            <Drawer.Title className="drawer-example-title">
              Filters
            </Drawer.Title>
            <Drawer.Description className="drawer-example-description">
              Refine visible rows by status, owner, and update time.
            </Drawer.Description>
            <div className="drawer-example-grid">
              <span>Status</span>
              <strong>Open</strong>
              <span>Owner</span>
              <strong>Design</strong>
              <span>Updated</span>
              <strong>Today</strong>
            </div>
            <Drawer.Close density-emphasis="primary">
              Apply filters
            </Drawer.Close>
          </Drawer.Content>
        </Drawer.Popup>
      </Drawer.Portal>
    </Drawer.Root>
  );
}

Props

Prop Attribute Values Default
Drawer.Trigger density-presentation data-dn-presentation button button
Drawer.Trigger density-emphasis data-dn-emphasis primary, secondary, outline, ghost secondary
Drawer.Trigger density-size data-dn-size 2xs, xs, sm, md, lg, xl, 2xl, 3xl md
Drawer.Close density-presentation data-dn-presentation button button
Drawer.Close density-emphasis data-dn-emphasis primary, secondary, outline, ghost ghost
Drawer.Close density-size data-dn-size 2xs, xs, sm, md, lg, xl, 2xl, 3xl md
Drawer.Popup density-presentation data-dn-presentation card card
Drawer.Popup density-level data-dn-level 1, 2, 3, 4, 5, 6, 7 3
Other Drawer parts Mixed Base UI drawer props None