Skip to Content
Neshel-UI
Components

Sheet

A modal panel that slides from an edge — filters, details and navigation drawers.

Client component ("use client")

Purpose

Sheet is a modal dialog anchored to an edge of the viewport. It shares Dialog's behaviour; only its placement differs. ("Drawer" in other libraries.)

Import

import.tsx
import {
  Sheet,
  SheetBody,
  SheetClose,
  SheetContent,
  SheetDescription,
  SheetFooter,
  SheetHeader,
  SheetTitle,
  SheetTrigger,
} from "@neshel-ui/components";

Usage

Preview: sheet-sides
Preview theme
sheet-sides.tsx
import {
  Button,
  Input,
  Sheet,
  SheetBody,
  SheetContent,
  SheetDescription,
  SheetHeader,
  SheetTitle,
  SheetTrigger,
} from "@neshel-ui/components";
import { Inline } from "@neshel-ui/layout";

const sides = ["left", "right", "top", "bottom"] as const;

export default function SheetSides() {
  return (
    <Inline space="3" wrap>
      {sides.map((side) => (
        <Sheet key={side}>
          <SheetTrigger asChild>
            <Button variant="outline">Open {side}</Button>
          </SheetTrigger>
          <SheetContent side={side}>
            <SheetHeader>
              <SheetTitle>Filters</SheetTitle>
              <SheetDescription>Narrow the results ({side} sheet).</SheetDescription>
            </SheetHeader>
            <SheetBody>
              <Input aria-label="Keyword" placeholder="Keyword" />
            </SheetBody>
          </SheetContent>
        </Sheet>
      ))}
    </Inline>
  );
}

API

SheetProps

Also accepts the props of: @radix-ui/react-dialog.

SheetContentProps

SheetContentProps
PropTypeDefaultDescription
closeLabelstring"Close"Accessible name of the close button (default "Close").
containerHTMLElement | nulldocument.bodyPortal target (default document.body, wrapped with the trigger's theme).
refRef<HTMLDivElement>——
showClosebooleantrueRender a close button with an accessible label (default true).
sideSheetSide"right"Edge the sheet slides from (default "right").
size"sm" | "md" | "lg""md"Width (left/right) or height (top/bottom) of the sheet (default "md").

Also accepts the props of: @radix-ui/react-dialog, @radix-ui/react-dismissable-layer, @radix-ui/react-primitive, React DOM attributes.

SheetSide

type SheetSide = "left" | "right" | "top" | "bottom"

SheetTriggerProps

SheetTriggerProps
PropTypeDefaultDescription
refRef<HTMLButtonElement>——

Also accepts the props of: @radix-ui/react-primitive, React DOM attributes.

SheetCloseProps

SheetCloseProps
PropTypeDefaultDescription
refRef<HTMLButtonElement>——

Also accepts the props of: @radix-ui/react-primitive, React DOM attributes.

SheetTitleProps

SheetTitleProps
PropTypeDefaultDescription
refRef<HTMLHeadingElement>——

Also accepts the props of: @radix-ui/react-primitive, React DOM attributes.

SheetDescriptionProps

SheetDescriptionProps
PropTypeDefaultDescription
refRef<HTMLParagraphElement>——

Also accepts the props of: @radix-ui/react-primitive, React DOM attributes.

SheetHeader, SheetBody and SheetFooter take the same props as DialogPartProps.

Controlled and uncontrolled

open / defaultOpen / onOpenChange, as Dialog.

Accessibility and keyboard

Identical to Dialog: a title is required, focus is trapped and restored, Escape closes. Swipe gestures are not provided.

Common mistakes

  • Building a mobile navigation drawer by hand: MobileMenu and the Sidebar drawer already handle closing after navigation.
Edit on GitHub

On this page