Import
import { Label } from "@timelycare/helix-ui"
Props
interface LabelProps extends React.LabelHTMLAttributes<HTMLLabelElement> {
htmlFor?: string
className?: string
children: React.ReactNode
}
Styling
| Property | Value | Tailwind |
|---|---|---|
| Font | Adelle Sans Medium | font-medium |
| Size | 14px | text-sm |
| Line height | 14px (1:1) | leading-none |
| Color | Default text | text-foreground |
States
| State | Implementation |
|---|---|
| Default | text-foreground font-medium text-sm leading-none |
| Disabled | peer-disabled:opacity-70 peer-disabled:cursor-not-allowed |
| Error | text-destructive (via FormLabel or manual) |
Common Patterns
Basic Label
<Label htmlFor="email">Email</Label>
<Input id="email" type="email" />
With Input (Stacked)
<div className="space-y-2">
<Label htmlFor="name">Name</Label>
<Input id="name" placeholder="Enter your name" />
</div>
With Checkbox
<div className="flex items-center gap-2">
<Checkbox id="terms" />
<Label htmlFor="terms">Accept terms and conditions</Label>
</div>
With Description
<div className="flex items-start gap-2">
<Checkbox id="marketing" className="mt-0.5" />
<div className="flex flex-col gap-1.5">
<Label htmlFor="marketing">Marketing emails</Label>
<p className="text-sm text-muted-foreground">
Receive emails about new products.
</p>
</div>
</div>
Horizontal Layout
<div className="flex items-center gap-4">
<Label htmlFor="name" className="w-16 shrink-0 text-right">Name</Label>
<Input id="name" placeholder="Enter name" />
</div>
Required Field
<Label htmlFor="email">
Email <span className="text-destructive">*</span>
</Label>
Accessibility
- Built on Radix Label — links to associated input automatically
- Clicking label focuses the associated input via
htmlFor - Screen reader: announces label text when input is focused
- No direct keyboard interaction
- Use with all form inputs for accessibility compliance
Gotchas
| Problem | Solution |
|---|---|
| Label not clickable | Match htmlFor to input id |
| Disabled label same opacity | Add peer to input, peer-disabled:opacity-70 to label |
| Label misaligned with checkbox | Use items-center for single line, items-start with description |
| Font not medium | Label requires explicit font-medium class |
| Line height too tall | Use leading-none for form labels |
| Error state not showing | Use FormLabel or manually add text-destructive |
See Also
- Related Components: Input (input labels), Form (form field labels), Checkbox (checkbox labels)
- Accessibility: Forms Accessibility — Label association patterns
Last updated: February 9, 2026