Label
Form field label with required indicator and floating state support.
Preview
Rendering the live preview…
defaultRendering the live preview…
requiredRendering the live preview…
primaryRendering the live preview…
dangerStructure
Anatomy
Visual breakdown of the component's internal structure with BEM class call-outs.
<origam-label> — 2 internal parts. The required indicator ② is a <sup>*</sup> appended when required=true.- 1.origam-label
- Root element. Renders as
<label>by default. Acceptstagoverride. - 2.origam-label sup
- Required indicator
<sup>*</sup>. Only rendered whenrequired=true. Color driven by--origam-label---required-indicator-color.
API
Props
All props accepted by this component, with their type, default value and description.
- textstring
- Label text content. Can also be set via the default slot.
- floatingbooleanfalse
- Activates the floating label variant (smaller font-size, hidden by default until field activation).
- requiredbooleanfalse
- Appends a <sup>*</sup> required indicator after the label text.
- namestring
- HTML name attribute forwarded to the root element.
- idstring
- classstring | Array<string> | object
- stylestring | Array<string> | object | StyleValue
- marginboolean | number | string
- CSS margin shorthand applied via the margin composable.
- marginTopboolean | number | string
- marginLeftboolean | number | string
- marginBottomboolean | number | string
- marginRightboolean | number | string
- marginBlockboolean | number | string
- marginInlineboolean | number | string
- marginInlineStartboolean | number | string
- marginInlineEndboolean | number | string
- marginBlockStartboolean | number | string
- marginBlockEndboolean | number | string
- paddingboolean | number | string
- CSS padding shorthand applied via the padding composable.
- paddingTopboolean | number | string
- paddingLeftboolean | number | string
- paddingBottomboolean | number | string
- paddingRightboolean | number | string
- paddingBlockboolean | number | string
- paddingInlineboolean | number | string
- paddingInlineStartboolean | number | string
- paddingInlineEndboolean | number | string
- paddingBlockStartboolean | number | string
- paddingBlockEndboolean | number | string
- borderboolean | number | string | TDirectionBoth | Array<TDirectionBoth>false
- Applies a border. Pass true for the default border or a CSS shorthand.
- borderTopboolean | number | string
- borderLeftboolean | number | string
- borderBottomboolean | number | string
- borderRightboolean | number | string
- borderBlockboolean | number | string
- borderInlineboolean | number | string
- borderInlineStartboolean | number | string
- borderInlineEndboolean | number | string
- borderBlockStartboolean | number | string
- borderBlockEndboolean | number | string
- borderColorstring
- borderStylestring
- borderTopColorTColor
- borderRightColorTColor
- borderBottomColorTColor
- borderLeftColorTColor
- borderInlineStartColorTColor
- borderInlineEndColorTColor
- borderBlockStartColorTColor
- borderBlockEndColorTColor
- Border-radius token or boolean.
- roundedTopRightboolean | number | string
- roundedTopLeftboolean | number | string
- roundedBottomLeftboolean | number | string
- roundedBottomRightboolean | number | string
- roundedStartStartboolean | number | string
- roundedStartEndboolean | number | string
- roundedEndStartboolean | number | string
- roundedEndEndboolean | number | string
- color
- Foreground (text) color. Accepts semantic intents or a CSS color.
- bgColor
- Background color override.
- tagstring'label'
- HTML element rendered at root. Defaults to <label>.
- fontSizeTFontSize
- fontWeightTFontWeight
- lineHeightTLineHeight
- letterSpacingTLetterSpacing
API
Slots
Content slots exposed by this component.
- #default
- Main label content. Overrides the text prop. The required indicator <sup>*</sup> is appended after the slot when required=true.
API
Emits
Events emitted by this component.
- @clickMouseEvent
- Fired when the label element is clicked.
API
Exposed members
Properties and methods accessible via template ref (defineExpose). Use them for programmatic control.
- <T extends object>(props: T, exclude?: string[]) => Partial<T>
- Utility to forward a filtered subset of props to a child component.
- Ref<string>
- Reactive CSS string generated by useStyle.
- string
- Unique style-sheet ID for this instance.
- () => void
- Injects the computed style sheet into the document.
- () => void
- Removes the injected style sheet.
- Ref<boolean>
- True once the style sheet has been injected into the DOM.
Customisation
CSS variables
CSS custom properties exposed by this component. Override them to customise the component without losing theme compatibility.
- Default label text color.
- Default font size. Overridden to 1em when used inside OrigamField.
- Label font weight.
- Label line height.
- Label letter spacing.
- Labels do not capture pointer events (positioned on top of input).
- Duration of opacity/transform transitions for the float animation.
- Color of the asterisk required indicator <sup>*</sup>.
- Font size of the floating variant (clone shown in the field notch).
Inclusion
Accessibility
ARIA roles, keyboard navigation and focus management. Sourced from the real component template.
ARIA roles
Keyboard interactions
| Key | Action |
|---|---|
| click on label | Clicking the label focuses its associated input (native <label> for= binding). |
Notes
- Use the for= attribute (via id matching) or wrap the input inside the label to associate them. The component does not auto-generate the for= relationship.
- The <sup>*</sup> required indicator is a visual cue only. Screen readers may not announce it. Pair with aria-required="true" on the input for complete accessibility.
Foundation
Design tokens
Excerpt from this component's token declarations — the --origam-<component>---<property> variables, declared in its hand-maintained token sheet with no build step.
- colorvar(--origam-color__text---secondary)
- Default label text color.
- dimensionvar(--origam-font__size---md)
- Default font size.
- fontWeightvar(--origam-font__weight---regular)
- Label font weight.
- durationvar(--origam-motion__duration---normal)
- Duration of float animation transitions.
- colorvar(--origam-color__feedback--danger---fgSubtle)
- Color of the asterisk required indicator.
Interactive
Playground
Edit props live and see the component update in real time. The generated code snippet updates as you change values.
Rendering the live preview…
Usage
Examples
Ready-to-paste code snippets for your templates.
Basic label
Required field
Color variants