shadcn.io is not affiliated with official shadcn/ui
Field examples · Toggles
Switch with Description Field for React
A multi-factor authentication switch with a label and a description.
A setting that needs explaining before people turn it on. FieldContent stacks the Multi-factor authentication label and its description, and the Switch sits at the end of the horizontal row.
Preview
Installation
FAQ
How do the sentences line up with the switch?
orientation is horizontal. FieldContent comes first and holds the FieldLabel and FieldDescription, and the Switch is the other child.
What does the description say?
The label is Multi-factor authentication. The description says to enable it, and that a one-time code sent to email can stand in when there is no two-factor device.
How does the label connect to the switch?
FieldLabel names the switch. Its htmlFor matches the control's id. FieldContent groups that label with the description so they stack beside the switch.
Does the switch start on?
This switch does not pass a checked default, so it starts off. max-w-md caps the row.
Related
- Simple Switch FieldAn airplane mode switch with its label on
- Checkbox with Description FieldA checked checkbox with a label and a
- Simple Checkbox FieldA terms and conditions checkbox with its
- Input with Description Below FieldA username input with helper text under it
- Textarea with Description FieldA feedback textarea with a description
- Complex Multi-Field FormA personal information fieldset with