Xzero UI
Pro library

Drawer

A temporary side surface for focused work.

$ pnpm dlx shadcn@4.23.0 add @xzero-ui/drawer
Live · keyboard ready

When to use

When not to use

Installation

Register both Xzero UI namespaces in your project's components.json:

{
  "registries": {
    "@xzero-ui": "https://mcp.xzero.co.uk/r/{name}.json",
    "@xzero-ui-pro": "https://mcp.xzero.co.uk/r/pro/{name}.json"
  }
}
npx shadcn@4.23.0 add @xzero-ui/drawer

Install xzero-foundation once, and import @/components/xzero/foundation.css in your app root. No Xzero token is used by this snapshot. For sample portraits, photos, fonts, or logos, download https://mcp.xzero.co.uk/install-assets.mjs and run node xzero-install-assets.mjs <receiving-project>.

Usage

import { Drawer, DrawerTrigger, DrawerContent, DrawerClose } from "@/components/xzero/drawer/drawer";
import { Button } from "@/components/xzero/button/button";

export function FiltersDrawer() {
  return (
    <Drawer>
      <DrawerTrigger asChild><Button variant="secondary">Filters</Button></DrawerTrigger>
      <DrawerContent title="Filters" description="Narrow the list of projects.">
        <FilterForm />
        <DrawerClose asChild><Button>Apply</Button></DrawerClose>
      </DrawerContent>
    </Drawer>
  );
}

API reference

Drawer

Root. A Radix Dialog root that keeps the panel mounted while it slides out and closes it after a drag.

PropTypeDefaultDescription
openboolean–Controlled open state.
defaultOpenbooleanfalseInitial state when uncontrolled.
onOpenChange(open: boolean) => void–Called when the drawer opens or closes.
...propsComponentPropsWithoutRef<typeof DialogPrimitive.Root>–Other Radix Dialog root props, such as modal and children.

DrawerTrigger

Radix Dialog.Trigger. Use asChild to wrap your own button.

PropTypeDefaultDescription
...propsComponentPropsWithoutRef<typeof DialogPrimitive.Trigger>–Radix trigger props, including asChild.

DrawerContent

Overlay and panel with a titled header that doubles as the drag handle, a close button, and a scrolling body.

PropTypeDefaultDescription
title (required)string–Rendered as the dialog title. A new title rises in while open.
descriptionstring–Rendered as the dialog description under the title.
side"left" | "right" | "top" | "bottom""right"Edge the panel attaches to and slides from.
children (required)ReactNode–Body content.
...propsComponentPropsWithoutRef<typeof DialogPrimitive.Content>–Radix content props such as className, onInteractOutside, and onEscapeKeyDown.

DrawerClose

Radix Dialog.Close for extra close buttons in the body or footer.

PropTypeDefaultDescription
...propsComponentPropsWithoutRef<typeof DialogPrimitive.Close>–Radix close props, including asChild.

Keyboard interactions

KeysAction
EscapeCloses the drawer and returns focus to the trigger.
Tab / Shift+TabCycles focus within the panel while it is open.

Accessibility

Motion

Responsive behavior

Performance

Notes for AI

Also in overlays

Guidance for AI tools

Drawer: A temporary side surface for focused work. Follow the declared prop types and do not invent props. Keep keyboard access, reduced motion support, and both light and dark themes intact when adapting it.

Full library index: https://ui.xzero.co.uk/llms.txt

Browse all components