Label
A text label for a form control.
import { Input } from "@dapplelight/signet-ui/components/input"
import { Label } from "@dapplelight/signet-ui/components/label"
export function Demo() {
return (
<div className="grid w-full max-w-sm gap-2">
<Label htmlFor="customer">Customer</Label>
<Input id="customer" defaultValue="Northwind Traders" />
</div>
)
}Installation
npm i @dapplelight/signet-uiUsage
import { Label } from "@dapplelight/signet-ui/components/label"
import { Input } from "@dapplelight/signet-ui/components/input"
<Label htmlFor="email">Email</Label>
<Input id="email" />Examples
With checkbox
import { Checkbox } from "@dapplelight/signet-ui/components/checkbox"
import { Label } from "@dapplelight/signet-ui/components/label"
export function Demo() {
return (
<div className="flex items-center gap-2">
<Checkbox id="reminders" defaultChecked />
<Label htmlFor="reminders">Send payment reminders</Label>
</div>
)
}Disabled
import { Input } from "@dapplelight/signet-ui/components/input"
import { Label } from "@dapplelight/signet-ui/components/label"
export function Demo() {
return (
<div className="grid w-full max-w-sm gap-2">
<Label htmlFor="invoice-no" className="opacity-50">
Invoice number
</Label>
<Input id="invoice-no" disabled defaultValue="INV-1042" />
</div>
)
}API Reference
Label
| Prop | Type | Default | Description |
|---|---|---|---|
htmlFor | string | none | The id of the control it names. |
className | string | none | Merged last. |
Plus every <label> prop. It dims when a sibling marked peer is disabled. For a label tied to errors and descriptions, use Field.