Skip to content
shadcn.io

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.

Framework
UI library

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

Preview width

Installation

Sign in to get your install command
Free with an account. It carries your token, so the CLI installs everything in one go.

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.

How does Edit Profile open the sheet?

The button labeled Edit Profile 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.

What does the 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. It reads Edit Profile, and the description tells people to save when they're done.