A panel that slides in from the edge of the screen.
$ pnpm dlx shadcn@latest add https://dashral.com/r/sheet.jsonInstallation
$ pnpm dlx shadcn@latest add https://dashral.com/r/sheet.jsonAdds the component, the components it builds on, its npm packages and the theme tokens it uses. Using Dashral often? Add the registry to components.json once:
{
"registries": {
"@dashral": "https://dashral.com/r/{name}.json"
}
}Then add components by name:
$ pnpm dlx shadcn@latest add @dashral/sheetUsage
import { Button } from "@/components/dashral/button"
import { Select } from "@/components/dashral/select"
import { Sheet, SheetClose } from "@/components/dashral/sheet"
<Sheet
trigger={<Button variant="outline">Filters</Button>}
title="Filters"
footer={
<SheetClose asChild>
<Button>Show results</Button>
</SheetClose>
}
>
<Select label="Status" options={["Active", "Paused", "Archived"]} />
</Sheet>Examples
Filters
A draft until “Show N products”, whose count follows every change; applied filters become removable chips.
API reference
Sheet
Also takes every prop of Radix Dialog(opens in a new tab).
| Prop | Type | Default |
|---|---|---|
trigger | ReactElementWhat opens it. Leave it out to open it with open / onOpenChange. | — |
title | ReactNodeRequired: it names the panel. | — |
description | ReactNode | — |
children | ReactNodeThe body; it scrolls when it's taller than the screen. | — |
footer | ReactNodePinned to the bottom. | — |
form | ComponentProps<"form">Makes the body and footer one form. | — |
side | "top" | "bottom" | "start" | "end" | "left" | "right"Which edge it slides from. start and end follow the reading direction (end is the right, or the left in Arabic). | "end" |
padding | "default" | "none"none hides the header visually and drops the body's padding, for a layout of your own. | "default" |
showCloseButton | boolean | true |
autoFocus | booleanOpening it focuses the first control inside. false focuses the panel instead, e.g. a menu whose first control is a text field, so a phone doesn't open its keyboard. | true |
classNames | { header, title, description, body, footer }Classes for each part. | — |
className | stringThe panel's classes, e.g. a width. | — |
SheetClose
Closes the sheet: wrap a button.
Also takes every prop of Radix Dialog(opens in a new tab).
| Prop | Type | Default |
|---|---|---|
asChild | booleanRender the child element instead (e.g. a Next.js Link), passing these styles and props to it. | false |
Keyboard
| Keys | Action |
|---|---|
| TaborShift+Tab | Move between controls; focus stays inside while it's open |
| Escape | Close and return focus to what opened it |
Accessibility
- A modal dialog: it's named by its title, traps focus and gives it back when closed.
Motion
- Slides in from its side and out again; the backdrop fades.