Installation
npx logic2b@next add labelUsage
import { Label } from "@/components/ui/label"
<Label htmlFor="email">Your email address</Label>
Usage notes
Label forwards every prop to the underlying Radix Label.Root (a native
<label>), so all standard label attributes apply.
It also picks up peer-disabled and group-data-[disabled=true] styles
automatically when placed next to a disabled control.
Examples
With a checkbox
Required field
Live playground
Edit the component props and inspect the exact JSX before copying it. The preview loads only when this section enters the viewport.
Generated JSX
<Label
htmlFor="workspace-name"
>
<span>Workspace</span>
<input
type="text"
defaultValue="logic2b"
className="h-9 rounded-md border bg-background px-3 text-sm"
id="workspace-name"
/>
</Label>API reference
Generated from the public TypeScript exports in src/ui/label.tsx.
Label
ComponentProps: React.ComponentProps<typeof LabelPrimitive.Root>Accessibility contract
Machine-readable behavior and consumer responsibilities for label.
- Support
- Native semantics
- Pattern
- form label
- HTMLLabelElement
Built-in semantics
- Uses native label semantics and forwards htmlFor to its labelled control.
Consumer responsibilities
- Point htmlFor at exactly one labelable control and keep the label text visible.