Field Label
@astryxdesign/core v0.7.1 · FieldLabel
Props
| Prop | Type | Default | Description |
|---|---|---|---|
label | string | — | Label text. Required. |
inputId | string | — | id of the control this label belongs to. Becomes the for attribute, and the base for the generated label and description ids. Required. |
labelId | string | `${inputId}-label` | id put on the label element itself. Point the control's aria-labelledby at it when the label is not a real label. |
description | string | — | Supporting line under the label. Clicking it focuses the control, unless the label is a group label or disabled. |
descriptionId | string | `${inputId}-description` | id put on the description. Reference it from the control's aria-describedby. |
isGroupLabel | boolean | false | Renders the label as a span with no for, for a group of controls instead of a single input. |
isLabelHidden | boolean | false | Hides the label visually. It stays in the accessibility tree. |
isDisabled | boolean | false | Dims the label and stops the description from focusing the control. |
isOptional | boolean | false | Shows the optional marker. Wins over isRequired when both are set. |
isRequired | boolean | false | Shows the required marker. Inside a FormLayout with defaultOptionality="required" the marker is suppressed, because being required is the default. |
labelIcon | IconName | Component | — | Icon rendered before the label text, inside a 16px box. The wrapper is aria-hidden, so the icon must not carry meaning on its own. |
labelTooltip | string | — | Tooltip text for the info button at the end of the label row. |
optionalLabel | string | 'Optional' | Text of the optional marker. Override it to localize. |
requiredLabel | string | 'Required' | Text of the required marker. Override it to localize. |
Slots
labelIcon: icon before the label text. Same place as thelabelIconprop, and the slot wins when both are passed.
Exposed
element: the rendered label element.