Skip to Content

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-ui

Usage

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

PropTypeDefaultDescription
htmlForstringnoneThe id of the control it names.
classNamestringnoneMerged last.

Plus every <label> prop. It dims when a sibling marked peer is disabled. For a label tied to errors and descriptions, use Field.