elements
Demos UI Feed Discuss Install
Style System
  • Style
  • Themes
  • Behaviors
Forms
  • Button
  • ButtonGroup
  • Checkbox
  • ColorPicker
  • Combobox
  • Field
  • FileUpload
  • Input
  • InputGroup
  • InputOTP
  • Label
  • NativeSelect
  • NumberInput
  • PasswordInput
  • RadioGroup
  • Select
  • Slider
  • Switch
  • TagsInput
  • Textarea
  • Toggle
  • ToggleGroup
Overlays
  • AlertDialog
  • Command
  • ContextMenu
  • Dialog
  • Drawer
  • DropdownMenu
  • HoverCard
  • Menubar
  • NavigationMenu
  • Popover
  • Sheet
  • Toast
  • Tooltip
Display
  • Accordion
  • Alert
  • AspectRatio
  • Avatar
  • Badge
  • Breadcrumb
  • Card
  • Collapsible
  • Empty
  • Item
  • Kbd
  • Pagination
  • Progress
  • Separator
  • Skeleton
  • Spinner
  • Table
  • Tabs
  • Tree
Layout
  • Carousel
  • Resizable
  • ScrollArea
  • Sidebar
Dates
  • Calendar
  • DatePicker
  • DateRangePicker
  • TimePicker
Data
  • AreaChart
  • BarChart
  • Chart
  • DataTable
  • Kanban
  • LineChart
  • PieChart
  • RadarChart
  • RadialChart
  • VirtualList
Chat
  • Attachment
  • Message
  • MessageList
  • PromptInput
Elements UI / Forms / Label

Label

A native label for a control, which dims when the control is disabled.

For a control

htmlFor names the control by id; clicking the label focuses it.

Code
<Label htmlFor="email">Email</Label>
<Input type="email" attrs={{ id: "email" }} />

Usage

import { Label } from "@elements/ui/label";

<Label htmlFor="email">Email</Label>
<Input value={form.email} attrs={{ id: "email" }} />

<Label><Checkbox checked={form.terms} /> Accept the terms</Label>

Examples

Wrapping a control

A wrapped control is labelled without an id. Double clicking the text does not select it.

terms: false
Code
<Label>
  <input type="checkbox" checked={state.terms}>
  Accept terms and conditions
</Label>

Required

An asterisk for sighted users; the control's required is what is announced.

Code
<Label htmlFor="company" required>Company</Label>
<Input required attrs={{ id: "company" }} />

Disabled controls

The label dims with its control, whichever side of it the control sits.

Code
<Label htmlFor="locked">Locked</Label>
<Input disabled attrs={{ id: "locked" }} />

<input type="checkbox" disabled id="off">
<Label htmlFor="off">Unavailable option</Label>

Right to left

A label and its control follow the inline direction.

Reference Label in the manual Every part, attribute, slot, key and data attribute.
Prev InputOTPNext NativeSelect
Product
Manual Pricing Compare
Company
History Contact
Legal
Privacy Policy Acceptable Use Terms License Agreement
© Elements Dev Corporation 2026