Label
The Label component provides you with form labels and descriptions.
Import
import { Label } from '@nostromo/ui-core'
// or
import { Label } from '@nostromo/ui-core/label'Usage
import { Label, Input } from '@nostromo/ui-core'
export default function Example() {
return (
<div className="space-y-2">
<Label htmlFor="email">Email</Label>
<Input id="email" type="email" />
</div>
)
}Live Examples
Live Example
View Code
import { Label } from '@nostromo/ui-core'
export default function LabelExample() {
return (
<div className="space-y-4">
<div>
<Label htmlFor="email">Email</Label>
<input id="email" type="email" className="mt-1" />
</div>
...
With Checkbox
Live Example
View Code
import { Label, Checkbox } from '@nostromo/ui-core'
export default function LabelWithCheckbox() {
return (
<div className="flex items-center space-x-2">
<Checkbox id="terms" />
<Label htmlFor="terms">Accept terms and conditions</Label>
</div>
)
}...
Props
| Prop | Type | Default | Required | Description |
|---|---|---|---|---|
htmlFor | string | undefined | No | ID of the form control this label is for |
variant | "default" | "muted" | "error" | "default" | No | Visual variant |
size | "sm" | "default" | "lg" | "default" | No | Size of the label |
weight | "normal" | "medium" | "semibold" | "bold" | "medium" | No | Font weight |
className | string | undefined | No | Additional CSS classes |
children | React.ReactNode | undefined | No | Label content |
Standard HTML Label Props
The Label component extends React.LabelHTMLAttributes<HTMLLabelElement>, so it accepts all standard HTML label attributes (e.g., id, data-*, aria-*).