Docs
label
label
Renders an accessible label associated with controls.
Installation
npx shadcn@latest add label
npx shadcn@latest add label
Usage
import { Label } from "@/components/ui/label"
import { Label } from "@/components/ui/label"
<Label htmlFor="email">Your email address</Label>
<Label htmlFor="email">Your email address</Label>
API Reference
Label
props
(React.HTMLProps<HTMLLabelElement>
): Other native label props such ashtmlFor
,children
, etc.
Behavior:
- Renders a styled
<label>
element with default font size, weight, and disabled state styles. - Supports merging custom classes via the
cn
utility. - Works well with form inputs, especially when using
peer
selectors for interactivity.