elements
Blog Demos UI Docs Pricing
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. The label dims when its control is disabled.

For a control

htmlFor names the control by id. Clicking the label focuses the control.

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

Usage

template.ehtml
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 labeled 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 marks the field for sighted users. Screen readers announce the control's required attribute.

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