shadcn.io is not affiliated with official shadcn/ui
Sheet examples · Form
Contact Form Sheet for React
A right-side contact sheet with name, email and message fields and a Send Message button.
A contact form that slides in from the right, so people can write to you from any page. Name, Email and Message each sit in a Field with their label, and Send Message ends the column. Put the fields in a form and send them to your support inbox.
Preview
Installation
FAQ
Which fields does the form have?
Name, Email and Message, each an input with a placeholder. Email uses type="email", so phones show the email keyboard. For long messages, swap the Message input for a Textarea.
Does Send Message submit anything?
Not yet: the fields aren't in a form and the button has no handler. Wrap the FieldGroup in a form with an onSubmit, and give the button type="submit".
How do I close the sheet after sending?
Control the open state and set it to false once the message is sent:
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 clicking Name focuses the name input and screen readers announce the label with it.
Related
- User Profile Edit SheetA right-side sheet for editing a username
- Create New Item SheetA right-side sheet for adding an item
- Search and Filter SheetA right-side filter sheet with a search
- Multi-Step Form SheetA right-side setup sheet on step 1 of 3
- Article Preview SheetA right-side sheet previewing an article
- Notification List SheetA right-side sheet listing notifications