shadcn.io is not affiliated with official shadcn/ui
Sheet examples · Form
User Profile Edit Sheet for React
A right-side sheet for editing a username and full name, with a Save Changes button in the footer.
A profile edit form in a right-side sheet, with the current values already in the fields. Username and Full Name start from defaultValue, so people change only what they need; Save Changes sits in SheetFooter.
Preview
Installation
FAQ
Where do the current values come from?
Each input sets defaultValue: @johndoe for Username and John Doe for Full Name. Pass your user's values the same way, or control the inputs if you validate as people type.
Does Save Changes close the sheet?
No, it's a plain Button. Save, then close the sheet by controlling its open state:
Pass open to Sheet; onOpenChange receives the next boolean.
How are the labels tied to the inputs?
Each label and input share a Field, so the label names the input and clicking it focuses the field.
Why does Save Changes sit at the bottom?
It's in SheetFooter, which takes the free space above it with mt-auto, so the button stays at the bottom of the panel.
Related
- Contact Form SheetA right-side contact sheet with name
- Create New Item SheetA right-side sheet for adding an item
- Multi-Step Form SheetA right-side setup sheet on step 1 of 3
- Bottom-Sliding SheetA sheet that slides up from the bottom of
- Search and Filter SheetA right-side filter sheet with a search
- Article Preview SheetA right-side sheet previewing an article