shadcn.io is not affiliated with official shadcn/ui
Field examples · Layouts
Mixed Orientations Field for React
A vertical input, a horizontal switch with a description and a horizontal checkbox in one group.
Each control in the layout it reads best in. A text input stacks under its label, a Switch sits at the end of a row beside a label and description held in FieldContent, and a Checkbox leads its label. All three are Fields in one FieldGroup, with orientation set per field.
Preview
Installation
FAQ
Why is Project Name stacked when the other rows are not?
That Field leaves orientation unset, so it stays vertical: FieldLabel, Input, then FieldDescription. The description reads This will be visible to all team members.
How does the public switch line up with its hint?
That Field sets orientation to horizontal. FieldContent holds the FieldLabel Make project public and the FieldDescription, and the Switch is the other child.
How is the archive checkbox labeled?
The Checkbox comes first, then a FieldLabel with font-normal. The label reads Archive this project when complete. orientation is horizontal.
How do the labels connect to their controls?
FieldLabel names that control. Its htmlFor matches the control's id. Project Name's input is type text, with placeholder My Project.
Related
- Vertical Layout (Default) FieldTwo stacked fields, each with its label
- Horizontal Layout FieldAn input and a select, each with its
- Nested FieldsA shipping address fieldset with a nested
- Default SwitchA switch in its default off state, with
- Simple CheckboxA checkbox with a label for a single
- Preferences Dropdown Dropdown MenuAn editor preferences menu of five