Label
Renders an accessible label associated with controls.
Installation
npm i @radix-ui/react-labelUsage
1
2
3
4
5
6
7
8
9
10
import { Label } from "@/components/ui/label"
export function LabelDemo() {
return (
<div className="flex flex-col space-y-2">
<Label htmlFor="email">Email</Label>
<input id="email" type="email" />
</div>
)
}Examples
Required Label
Different Colors
Props
| Component | Props | Description |
|---|---|---|
| Label | LabelPrimitive.LabelProps htmlFor: string | The label component with an optional htmlFor attribute to associate it with a form control. |