shadcn.io is not affiliated with official shadcn/ui
Field examples · Basic Inputs
Horizontal Layout Input Field for React
An input with its label beside it in a horizontal field.
Label and input on one row, for settings panels and admin screens where vertical space is short. orientation="horizontal" on Field puts the Display Name label beside the input, and a fixed w-32 on the label keeps the input aligned when several rows stack.
Preview
Installation
FAQ
How do the label and input share a row?
orientation is horizontal on Field, so Display Name and the input sit side by side. Field sets data-orientation to horizontal.
Why does the label have a fixed width?
w-32 on FieldLabel holds the label at a fixed width, so the input starts at the same inset. The field itself is capped with max-w-md.
How does Display Name connect to the input?
FieldLabel names the input. Its htmlFor matches the control's id. The label text is Display Name.
What does the input accept?
type is text. The placeholder is John D., and it clears once someone types.
Related
- Simple Input with Label FieldAn email input with its label above it
- Multiple Inputs in Group FieldFirst name, last name and email inputs
- Choice Cards FieldRadio choice cards, each a bordered row
- Field Group with SeparatorTwo notification fieldsets of checkboxes
- Right Drawer Settings PanelA right drawer of settings switches
- Input with Description Above FieldA password input with its requirement