Label
Caption that names and activates the control referenced by its for attribute, with a required marker.
Attributes
| Name | Type | Default | Description |
|---|---|---|---|
disabled | boolean | false | Disables the label: clicks no longer reach the control and the text is dimmed. |
required | boolean | false | Shows the required indicator after the text. |
for | string | — | id of the control this label describes. It is looked up in the label's own root, then among its siblings. |
Slots
| Name | Description |
|---|---|
default | Label text. |
required-indicator | Marker shown after the text when required is set. Defaults to an asterisk. |
CSS parts
Shadow DOM styling hooks used with ::part(name). Prefer CSS custom properties when they cover the change.
| Name | Description |
|---|---|
label | The label text and optional required marker. |
required-indicator | Marker containing the required-indicator slot or fallback asterisk while required is set. |
CSS custom properties
Grouped by semantic target and state from --c2-<component>__<target>__<state>--<property>. Click a group to collapse it; click a name to copy it.
| Name | Type | Default | Description |
|---|---|---|---|
--c2-label__container--gap | pixel | 4px | |
--c2-label__container--color | color | inherit | |
--c2-label__container--font-family | font-family | inherit | |
--c2-label__container--font-size | pixel | inherit | |
--c2-label__container--font-weight | font-weight | inherit | |
--c2-label__container--line-height | line-height | inherit | |
--c2-label__container--letter-spacing | pixel | inherit | |
--c2-label__container--text-transform | text-transform | inherit | |
--c2-label__container__hover--color | color | — | |
--c2-label__container__disabled--opacity | opacity | 0.38 | |
--c2-label__required-indicator--color | color | rgb(211, 21, 16) | |
--c2-label__required-indicator--font-size | pixel | inherit | |
--c2-label__required-indicator--font-weight | font-weight | inherit | |