Skip to content
v0.2.10

Drawer

A modal edge panel with a steady header, scrollable body and optional footer.

Preview

Project settings

Make this space yours.

Use Drawer

Drawer is a named export of @flood-md/react. Connect the package once, then import what you use.

First time here? Connect Flood
Example import style
drawer.tsxTSX
"use client";

import { FloodRoot, Drawer, Button, Field, Input } from "@flood-md/react";
import "@flood-md/react/styles.css";

export function Example() {
  return (
    <FloodRoot>
      <Drawer title="Project settings" description="Keep the details close." trigger={props => <Button {...props}>Open settings</Button>}>
        <Field label="Project name">{control => <Input {...control} defaultValue="Flood" />}</Field>
      </Drawer>
    </FloodRoot>
  );
}

Design notes

  • Uses Flood native Dialog focus containment, scroll lock, background inertness, nested layers and return focus. Escape and the named close IconButton dismiss it; closeOnOutsideClick defaults to true. Controlled open/onOpenChange and initialFocusRef match Dialog.
  • side is logical start/end or physical top/bottom. size sets 20/26/34rem for sm/md/lg, capped to the viewport. Vertical drawers occupy the viewport height; horizontal drawers occupy its width. Entry motion respects reduced motion; closing is immediate.
  • The body scrolls with Flood ScrollArea while the header and optional footer remain visible when space allows. Responsive padding and full-width narrow descriptions preserve the reading area at enlarged text; if the chrome cannot fit, the whole panel can scroll rather than clipping the body. Footer actions are host-owned, without implicit save or close. No swipe/drag gesture or nested navigation engine is included. Available in 0.2.5.

API reference

PropValuesDefault
titlestringRequired
descriptionstring—
trigger(props: OverlayTriggerProps) => ReactNodeRequired
childrenReactNode—
openboolean—
defaultOpenbooleanfalse
onOpenChange(open: boolean) => void—
disabledboolean—
closeLabelstring"Close"
closeOnOutsideClickbooleantrue
initialFocusRefRefObject<HTMLElement | null>—
side"start" | "end" | "top" | "bottom""end"
size"sm" | "md" | "lg""md"
footerReactNode—
Native HTML propsOmit<HTMLAttributes<HTMLDialogElement>, "children" | "title" | "role">Forwarded
View TypeScript source