---
title: "Sheet"
description: "A side panel with focus management, keyboard dismissal and a labelled title."
---

Interactive preview: https://ui.coderocket.app/docs/components/sheet

## Usage

Get this component from a [saved library export](/docs/export) or the [connected CLI](/docs/agents). The imports below refer to local files installed in your app.

Import `styles/components.css`, then `styles/theme.css` once. Wrap your app in `ThemeScope` from `components/ui/utils` so typography, focus and overlays share the theme. The [installation guide](/docs/export) covers runtime dependencies and React/Next.js setup.

```tsx
import { Sheet } from './components/ui/sheet';

<Sheet trigger="Open sheet" title="Workspace settings" description="Manage the details of your workspace."><Input aria-label="Workspace name" placeholder="Acme"/></Sheet>
```

## Design system

This component consumes your semantic colors, spacing, typography and shape tokens. Import the compiled styles and your theme once as described in [Export](/docs/export).

Dependencies: [Input](/docs/components/input).

## Behavior and accessibility

- Focus trap
- Escape dismisses
- Focus returns to trigger

Status: **experimental** during early access. Sample previews do not send emails, process payments or upload files to a service.

## Source and props

This is the exported source, using the same implementation as the editor.

```tsx
"use client";
import { Dialog as Base } from "@base-ui/react/dialog";
import type { ComponentProps, ReactNode } from "react";
import { cx, usePortalContainer } from "./utils";
export function Sheet({
  trigger,
  triggerRender,
  title,
  description,
  children,
  open,
  onOpenChange,
  initialFocus,
  finalFocus,
  className,
  footer,
  closeLabel = "Close",
  ...rootProps
}: Omit<ComponentProps<typeof Base.Root>, "children"> & {
  trigger?: ReactNode;
  /** Replace the trigger element without nesting interactive controls. */
  triggerRender?: ComponentProps<typeof Base.Trigger>["render"];
  className?: string;
  title: string;
  description?: string;
  children: ReactNode;
  initialFocus?: ComponentProps<typeof Base.Popup>["initialFocus"];
  finalFocus?: ComponentProps<typeof Base.Popup>["finalFocus"];
  footer?: ReactNode;
  closeLabel?: string;
}) {
  const container = usePortalContainer();
  return (
    <Base.Root {...rootProps} open={open} onOpenChange={onOpenChange}>
      {(trigger != null || triggerRender != null) && (
        <Base.Trigger
          render={triggerRender}
          className="cr-button"
          data-variant="outline"
        >
          {trigger}
        </Base.Trigger>
      )}
      <Base.Portal container={container}>
        <Base.Backdrop className="cr-backdrop" />
        <Base.Viewport className="cr-modal-viewport" data-kind="sheet">
          <Base.Popup
            className={cx("cr-modal cr-sheet", className)}
            initialFocus={initialFocus}
            finalFocus={finalFocus}
          >
            <header className="cr-modal-header">
              <Base.Title className="cr-modal-title">{title}</Base.Title>
              {description && (
                <Base.Description className="cr-description">
                  {description}
                </Base.Description>
              )}
              <Base.Close
                className="cr-modal-close"
                aria-label={closeLabel === "Close" ? "Close panel" : closeLabel}
              >
                <svg
                  width="18"
                  height="18"
                  viewBox="0 0 24 24"
                  fill="none"
                  stroke="currentColor"
                  strokeWidth="1.75"
                  strokeLinecap="round"
                  aria-hidden="true"
                >
                  <path d="m6 6 12 12M18 6 6 18" />
                </svg>
              </Base.Close>
            </header>
            <div className="cr-modal-content">{children}</div>
            {footer !== null && (
              <footer className="cr-modal-footer">
                {footer ?? (
                  <Base.Close className="cr-button" data-variant="secondary">
                    {closeLabel}
                  </Base.Close>
                )}
              </footer>
            )}
          </Base.Popup>
        </Base.Viewport>
      </Base.Portal>
    </Base.Root>
  );
}
```
