PrimitiveAvailable
Label
A visible semantic label associated with a form control.
Installation
Add the component and its dependencies from the registry running on your computer.
terminal
npx shadcn@latest add https://brutallab.facilito.dev/r/label.jsonUsage
Import the component into your project and keep the source code under your control.
tsx
'use client';
import { Label } from '@/components/ui/label';
import { Input } from '@/components/ui/input';
export default function Demo() {
return (
<div className="grid w-full max-w-md gap-2">
<Label htmlFor="display-name">Display name</Label>
<Input id="display-name" placeholder="Alex Morgan" />
</div>
);
}
States & interaction
Appearance, behavior and keyboard checks.
- Rest, filled, focus, invalid and disabled. Invalid fields use aria-invalid and an associated message, not color alone.
- Hover never validates a field. The application decides when to show errors.
- Test the example with Tab and Shift+Tab. Focus must stay visible in both themes.
API Reference
BrutalLab-specific properties. Native attributes are supported as well.
| Prop | Type | Default | Description |
|---|---|---|---|
| htmlFor | string | — | ID of the labelled control. |
Accessibility
Rules that should remain intact when adapting the component to a product.
Keep visible text labels and the semantic HTML shown in the example.
Retain keyboard focus styles and test the composition with keyboard navigation.
Use className for visual customization; preserve the primitive ARIA attributes.