1. Documentation
  2. Forms
  3. Label
ReadmenpmGitHub
  • Introduction
  • Installation
  • Theming
  • Icons
  • Accordion
  • Card
  • Scroll Area
  • Separator
  • Sidebar
  • Field
  • Label
  • Input
  • Textarea
  • Number Field
  • OTP Field
  • Select
  • Combobox
  • Checkbox
  • Radio
  • Switch
  • Slider
  • Toggle
  • Calendar
  • Date Picker
  • File Upload
  • Button
  • Copy Button
  • Dropdown
  • Command
  • Tabs
  • Breadcrumb
  • Pagination
  • Tree
  • Table
  • Data Table
  • Stat
  • Timeline
  • Avatar
  • Status Bar
  • Badge
  • Meter
  • Empty
  • Skeleton
  • Spinner
  • Toast
  • Dialog
  • Sheet
  • Popover
  • Tooltip
  • Text
  • Kbd
  • Code Block
  • Utilities
  • Design rules

Label

A form label with an optional marker and a right-aligned slot.

Loading documentation…

Field< PreviousInputNext >

Powered by heyo

On this page

UsageOptional and asideLabelling something that is not a fieldProperties
<Label htmlFor="token">API token</Label><Input id="token" placeholder="heyo_live_…" />

Label renders a <label> at 13px medium — the weight the system uses to name a surface or a group. Inside a Field it wires htmlFor automatically; standalone you pass htmlFor yourself.

You rarely render it directly. Input, Textarea, NumberField and OtpField take a label prop and build the whole field, including this.

Usage

tsx
import { Label } from "@heyo-sh/heyo-ui";<Label htmlFor="token">API token</Label>;

Optional and aside

32 characters
<Label htmlFor="notes" optional>Notes</Label><Label htmlFor="key" aside={<span className="text-heyo-subtle">32 characters</span>}>Signing key</Label>

optional is the inverse of marking everything required with an asterisk: in a form where most fields are required, the exceptions are the information worth carrying.

Labelling something that is not a field

render swaps the element while keeping the typography — useful for a group heading that labels several controls at once.

tsx
<Label render={<legend />}>Permissions</Label>

Properties

htmlForstringoptional

The id of the control this labels. Set automatically inside a Field.

optionalbooleanoptional

Appends a muted "Optional" marker.

asideReactNodeoptional

A right-aligned slot for a hint, a counter, or a link.

renderRenderPropoptional

Renders a different element with the same styling.

childrenReactNodeoptional

The label text.