Sheet
A sheet slides a panel in from the edge of the screen, over a dimmed page, for filters or details that don’t need a new page.
When to use
Section titled “When to use”- Use it for filters on a list, and for a side panel with the details of one row.
- Use a Dialog for a decision or a short form, and a page for a long flow.
- On phones, open it from the bottom as a bottom sheet.
Anatomy
Section titled “Anatomy”- 1Overlay
- 2Panel from the edge
- 3Title
- 4Action
A header with a title and one sentence of description, the content, and a footer with the main action. The panel sits on popover with a border on its inner edge and no radius on the edge that touches the screen, over the overlay token.
Variants
Section titled “Variants”| Side | Use it for |
|---|---|
right (default) |
Filters and details on the web. |
bottom |
Filters and actions on phones. |
left / top |
Rare; navigation menus use the Sidebar. |
| React | Vue | Flutter | Type | Default | Use |
|---|---|---|---|---|---|
side on SheetContent |
side on SheetContent |
side on showShadSheet |
text | right |
The edge it slides in from. |
open / onOpenChange |
v-model:open |
showShadSheet |
boolean | false |
Opens it from code. |
SheetTitle, SheetDescription |
SheetTitle, SheetDescription |
title, description |
text | none | Names the panel. |
SheetFooter |
SheetFooter |
actions |
element | none | The main action. |
import { useId } from "react"import { Button } from "@/components/ui/button"import { Checkbox } from "@/components/ui/checkbox"import { Label } from "@/components/ui/label"import { Sheet, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetTitle, SheetTrigger } from "@/components/ui/sheet"
const statuses = ["Terbit", "Menunggu", "Ditolak"]
export default function SheetDemo() { const id = useId() return ( <Sheet> <SheetTrigger render={<Button variant="outline" />}>Filter</SheetTrigger> <SheetContent side="right"> <SheetHeader> <SheetTitle>Filter rilis</SheetTitle> <SheetDescription>Tampilkan rilis dengan status yang kamu pilih.</SheetDescription> </SheetHeader> <div className="grid gap-3 px-4"> {statuses.map((status) => ( <div key={status} className="flex items-center gap-2"> <Checkbox id={`${id}-${status}`} /> <Label htmlFor={`${id}-${status}`}>{status}</Label> </div> ))} </div> <SheetFooter> <SheetClose render={<Button />}>Terapkan</SheetClose> </SheetFooter> </SheetContent> </Sheet> )}<script setup lang="ts">import { useId } from "vue"import { Button } from "@/components/ui/button"import { Checkbox } from "@/components/ui/checkbox"import { Label } from "@/components/ui/label"import { Sheet, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetTitle, SheetTrigger } from "@/components/ui/sheet"
const statuses = ["Terbit", "Menunggu", "Ditolak"]const id = useId()</script>
<template> <Sheet> <SheetTrigger as-child> <Button variant="outline">Filter</Button> </SheetTrigger> <SheetContent side="right"> <SheetHeader> <SheetTitle>Filter rilis</SheetTitle> <SheetDescription>Tampilkan rilis dengan status yang kamu pilih.</SheetDescription> </SheetHeader> <div class="grid gap-3 px-4"> <div v-for="status in statuses" :key="status" class="flex items-center gap-2"> <Checkbox :id="`${id}-${status}`" /> <Label :for="`${id}-${status}`">{{ status }}</Label> </div> </div> <SheetFooter> <SheetClose as-child> <Button>Terapkan</Button> </SheetClose> </SheetFooter> </SheetContent> </Sheet></template>import 'package:flutter/widgets.dart';import 'package:shadcn_ui/shadcn_ui.dart';
const statuses = ['Terbit', 'Menunggu', 'Ditolak'];
class SheetDemo extends StatelessWidget { const SheetDemo({super.key});
@override Widget build(BuildContext context) { return ShadButton.outline( child: const Text('Filter'), onPressed: () => showShadSheet( context: context, side: ShadSheetSide.right, builder: (context) => ShadSheet( constraints: const BoxConstraints(maxWidth: 384), title: const Text('Filter rilis'), description: const Text('Tampilkan rilis dengan status yang kamu pilih.'), actions: [ShadButton(child: const Text('Terapkan'), onPressed: () => Navigator.of(context).pop())], child: Column( mainAxisSize: MainAxisSize.min, crossAxisAlignment: CrossAxisAlignment.start, spacing: 12, children: [for (final status in statuses) ShadCheckbox(value: false, label: Text(status), onChanged: (_) {})], ), ), ), ); }}Install
Section titled “Install”npx shadcn@latest add https://design.sosialoka.tech/r/react/sheet.jsonnpx shadcn-vue@latest add https://design.sosialoka.tech/r/vue/sheet.jsonAccessibility
Section titled “Accessibility”- It is a dialog named by its title; the focus moves into it and back to the trigger when it closes.
- Escape and the close button close it.
- The page behind it can’t be reached until it closes.
