shadcn.io is not affiliated with official shadcn/ui
Label examples · Standard
Label with Description for React
A label with a line of muted helper text under it.
A caption that needs a sentence of context, such as what a username is used for. The Label says Username and a small muted paragraph under it says This will be your public display name. Inside a form, Field with FieldDescription does the same and ties the hint to the control.
Preview
Installation
FAQ
Where does the helper text sit?
Under the label, in a p. The wrapper is flex flex-col gap-1. The label says Username. The paragraph says "This will be your public display name".
How is the helper text styled?
text-muted-foreground text-xs on the paragraph. Label keeps the default text-sm font-medium caption. The paragraph is a sibling of the label, not a child of it.
What is the space between the label and the hint?
gap-1 on the column. The file does not use a space-y class.
Is the paragraph announced with an input?
No. There is no input and no aria-describedby. Field is the part that associates a caption and a description with the control. This demo is the label and the paragraph only.
Related
- Required LabelA label with a destructive asterisk that
- Label with TooltipA label with an info button that opens a
- Label with Optional IndicatorA label with a muted (optional) marker
- Input with LabelA text input with a label above it
- Simple TextareaA plain textarea with a placeholder and
- Error LabelA label in the destructive color with an