shadcn.io is not affiliated with official shadcn/ui
Drawer examples · Top
Simple Top Drawer for React
A drawer that slides down from the top with a title, a description, a short body and a Close button.
The basic top drawer: it slides down from the top edge with a header, a line of text and a Close button, and an upward swipe sends it back. Use it for search, announcements and quick actions that belong at the top of the screen.
Preview
Installation
FAQ
How does this drawer open from the top?
swipeDirection="up" on Drawer puts it on the top edge. The prop names the swipe that closes the drawer, so up docks it at the top; leave it out for a bottom drawer.
What's inside the drawer?
DrawerHeader with Top Drawer and This drawer slides down from the top, one paragraph, and DrawerFooter with Close.
How does Close work?
It's a DrawerClose, so it dismisses the drawer. Swiping it back toward its edge, Escape and a click on the overlay all close it, and focus goes back to the trigger.
The Button goes in the render prop of DrawerClose.
Is there a drag bar?
No. A side or top drawer still follows a swipe, but it doesn't draw the bar.
The bar stays off unless Drawer sets showSwipeHandle.
How does the trigger open it?
An outline button opens the drawer. Its text, Open Top Drawer, is the accessible name.
The Button goes in the render prop of DrawerTrigger.
Related
- Simple Bottom DrawerA bottom drawer with a title, a
- Simple Right DrawerA drawer that slides in from the right
- Top Drawer Search BarA top drawer with a large search field
- Top Drawer Notification BannerA top drawer shaped as a banner, with an
- Standard DialogA share dialog with a read-only link, a
- Top Drawer Command BarA top drawer with a large command field