shadcn.io is not affiliated with official shadcn/ui
Sheet examples · Standard
Top-Sliding Sheet for React
A sheet that slides down from the top of the screen with a title and a description.
side="top" on SheetContent is the whole difference: the panel slides down from the top, and the title, the focus trap and Escape work as on every other edge. Use it for announcements, a search bar or anything that reads best from the top down. The demo holds only the header, so put your own body under it.
Preview
Installation
FAQ
How do I open the sheet from the top?
Set side="top" on SheetContent. Leave it out and the sheet opens from the right. It takes top, right, bottom or left.
How tall is the top sheet?
A top sheet spans the full width and is as tall as its content, here just SheetHeader. Cap a long one with a class such as data-[side=top]:max-h-[50vh] and let its body scroll.
What does the top sheet announce?
SheetTitle names the dialog for assistive tech, so every sheet renders one; hide it with sr-only when the design has no visible heading. Here it reads Top Sheet, and SheetDescription reads This sheet slides down from the top of the screen.
How is Open Sheet connected?
The button labeled Open Sheet is the trigger, and its text is the accessible name.
The Button goes in the render prop of SheetTrigger, and the label stays its child.
Related
- Bottom-Sliding SheetA sheet that slides up from the bottom of
- Sheet with Title and DescriptionA right-side sheet whose header holds a
- Left-Sided SheetA sheet that slides in from the left edge
- Standard with Title AlertA neutral alert with only a title, for a
- Standard DialogA share dialog with a read-only link, a
- Article Preview SheetA right-side sheet previewing an article