Components
Renders an accessible label associated with controls.
Playground
htmlFor at the id of the control it describes. Label ships no color tokens of its own — it inherits the surrounding text color.import { Label } from "@workspace/ui/components/label"
<Label htmlFor="email">Your email address</Label><div className="flex items-center gap-2"> <Checkbox id="terms" /> <Label htmlFor="terms">Accept terms and conditions</Label> </div>
<div className="grid w-full max-w-sm gap-3"> <Label htmlFor="email">Email</Label> <Input id="email" type="email" placeholder="Email" /> </div>
peer-disabled styles dim the label automatically — Checkbox and Switch mark themselves as peers. Inside a disabled Field group the group-data-[disabled=true] variant does the same.<div className="flex items-center gap-2"> <Checkbox id="newsletter" disabled /> <Label htmlFor="newsletter">Subscribe to the newsletter</Label> </div> <div className="flex items-center gap-2"> <Switch id="marketing" disabled /> <Label htmlFor="marketing">Marketing emails</Label> </div>
<Field> <FieldLabel htmlFor="name">Name</FieldLabel> <Input id="name" /> <FieldDescription>Shown on your public profile.</FieldDescription> </Field>
<div dir="rtl" className="flex items-center gap-2"> <Checkbox id="terms-rtl" /> <Label htmlFor="terms-rtl">أوافق على الشروط والأحكام</Label> </div>
| Prop | Type | Default |
|---|---|---|
| htmlFor | string | — |
| asChild | boolean | false |
Tokens used
3 design tokens consumed by the Label component.
--text-sm
Text Small (14px)
--font-weight-medium
Font weight Medium (500)
--spacing
Spacing unit (4px)