Label
Give a native form control a visible accessible name.
Installation
pnpm dlx shadcn@4.18.0 add @siteplane/labelComplete the one-time setup first. Registry JSON lists source files and dependencies.
For this page’s examples, also install:
pnpm dlx shadcn@4.18.0 add @siteplane/checkbox @siteplane/inputUsage
import { Label } from "@/siteplane/components/label";
<Label htmlFor="workspace">Workspace name</Label>;Required fields and help
Label marks nothing as required and connects no help text. Compose a Field for both: requiredIndicator marks its label while the control is required, and the Field connects a FieldDescription to the control.
Used for account notifications.
With a checkbox
Wrap a Checkbox and its text in Label so clicking the text toggles it. The checkbox sits on the first line of the text, also when the text wraps. Label adds no validation.
A label above a field uses the 16 px line of FieldLabel. A label beside a checkbox, radio or switch keeps the 21 px body line, because such labels are sentences and often wrap.
Choice cards
Use variant="card" around a Checkbox, Radio or Switch. Label owns the shared
border, padding, hover, checked and disabled presentation; do not copy these
state classes into your own components. Keep secondary action buttons outside
the label.
API reference
| Prop | Type | Default | Description |
|---|---|---|---|
variant | default | card | default | Plain association or shared choice-card presentation. |
html | string | unset | ID of the labeled control. |
render | ReactElement | render function | label | Composed element; replacing label removes native label behavior unless restored by the application. |
children | ReactNode | unset | Visible label. |
class | string | unset | Additional styling. |
Remaining props and refs follow the native label and Base UI composition. Label adds no validation or control state. It dims as disabled when it carries data-disabled or holds a disabled form control, such as an input, a textarea, a Select trigger, a checkbox or the segments of a date field. A disabled button inside it does not dim it. There is no owned disabled prop.
Usage notes
Use Field and FieldLabel when automatic field association and validation are needed. Label and FieldLabel are distinct components. Clicking a native associated label focuses or activates its control.