Label
Names a form control, with an optional sublabel and required indicator.
Default
<.label label="Project name" />
Required
Adds an asterisk after the label.
*
<.label label="Build system" required />
Sublabel
Secondary text that adds context without lengthening the label.
How this endpoint will be listed in the table.
*
(HTTPS only)
<.label label="Name" sublabel="How this endpoint will be listed in the table." />
<.label label="Endpoint URL" sublabel="(HTTPS only)" required />
Disabled
Matches a disabled control.
*
(Managed by your identity provider)
<.label label="Organization" sublabel="(Managed by your identity provider)" required disabled />
Guidelines
-
Text input and text area take
label,sublabel, andshow_requireddirectly. Use this component above controls without a built-in label, such as a select. -
Additional attributes go on the inner
<label>element. Setforto the id of a native control so clicking the label focuses it. -
requiredonly shows the asterisk. Mark the control itself as required as well. -
Keep the label to a short noun phrase in sentence case, and move extra context into
sublabel.
API reference
<.label>
| Attribute | Type | Default | Description |
|---|---|---|---|
|
disabled
|
boolean
|
false
|
Whether the label is disabled
|
|
label
Required
|
string
|
–
|
The label
|
|
required
|
boolean
|
false
|
Whether the field is required
|
|
sublabel
|
string
|
nil
|
A sublabel
|
|
tooltip
|
string
|
nil
|
Help text shown in a tooltip from an icon after the label. Requires
tooltip_id
.
|
|
tooltip_id
|
string
|
nil
|
A stable, unique ID for the tooltip
|
Also accepts global attributes, including for.