Label
Label gives one form control a visible, clickable name through htmlFor or wrapper semantics.
Purpose
Label gives one form control a visible, clickable name through htmlFor or wrapper semantics.
Control labels
Installation
With the Siteplane registry alias configured, add the component and import the installed source from your app.
CLI
pnpm dlx shadcn@4.16.1 add @siteplane/labelImport
import { Label } from "@/components/ui/label";Need the machine-readable source metadata? View registry JSON.
Usage
Use Label for standalone labeled controls. Inside Field, prefer FieldLabel so errors and descriptions wire automatically.
import { Checkbox } from "@/components/ui/checkbox";
import { Label } from "@/components/ui/label";
export function Example() {
return <Label><Checkbox />Receive updates</Label>;
}Examples
Pairing, states, the render prop and practical label patterns are compositions of the same primitive.
With control
Nested control
Wrapping the control skips htmlFor and keeps the whole area clickable.
Required
Disabled
A disabled control inside the label dims the text and blocks the pointer.
Custom element
The render prop swaps the underlying element while keeping label styling.
Inline help
Setting row
API Reference
The reference lists the source-owned exports and props that are easy to miss in visual examples. Inherited Base UI props remain available unless the wrapper narrows them.
- Connect
htmlForto the controlid, or wrap the control when the primitive supports that pattern. rendermay change the underlying element while retaining Label behavior.- Use
FieldLabelinside Field so disabled and validation context stays synchronized.
Motion
Component motion uses the shared Siteplane motion contract. See the global motion guide for provider setup, tokens and reduced-motion behavior.
- Label has no animation.
- Clickable labels use a pointer cursor and activate their connected control.
- Disabled styling changes color without changing layout.
Accessibility
- Every visible Label must name exactly one connected control.
- Controls without visible labels require an explicit accessible name.
- Mark decorative required asterisks
aria-hidden; expose required state on the control itself. - Connect invalid state to the control and render a visible FieldError.
Implementation Guidance
- Do not render visible controls without a connected label or accessible name.
- Use FieldLabel inside Field and Label for direct control pairings.
- Preserve pointer, disabled, render, and native label behavior.