shadcn.io is not affiliated with official shadcn/ui
Sheet examples · Form
Create New Item Sheet for React
A right-side sheet for adding an item, with name, description and price fields and Cancel and Create buttons in the footer.
A create form in a right-side sheet: Item Name, Description and Price, with Cancel and Create side by side in SheetFooter. Cancel is a SheetClose, so it dismisses the panel; Create is yours to wire to the save.
Preview
Installation
FAQ
Which fields does the item form have?
Item Name and Description are text inputs, and Price is type="number" with 0.00 as its placeholder. Each sits in a Field with its label.
How does Cancel close the sheet?
It's wrapped in SheetClose, which closes the sheet when pressed. Use the same part for any button that should dismiss the panel.
Pass your button to SheetClose with render.
Does Create close the sheet?
No, it's a plain Button. Save the item, then close the sheet by controlling its open state:
Pass open to Sheet; onOpenChange receives the next boolean.
Why do the buttons sit at the bottom?
They're in SheetFooter, which takes the free space above it with mt-auto, so the actions stay at the bottom of the panel however short the form is.
Related
- User Profile Edit SheetA right-side sheet for editing a username
- Contact Form SheetA right-side contact sheet with name
- Multi-Step Form SheetA right-side setup sheet on step 1 of 3
- Search and Filter SheetA right-side filter sheet with a search
- Article Preview SheetA right-side sheet previewing an article
- Notification List SheetA right-side sheet listing notifications