Command Palette

Search for a command to run...

Label

Renders an accessible label associated with controls.

Installation

npm i @radix-ui/react-label

Usage

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

ComponentPropsDescription
LabelLabelPrimitive.LabelProps
htmlFor: string
The label component with an optional htmlFor attribute to associate it with a form control.