Label

Feedback & Status
stable

Form field label with required indicator and floating state support.

Preview

Rendering the live preview…

default

Rendering the live preview…

required

Rendering the live preview…

primary

Rendering the live preview…

danger

Structure

Anatomy

Visual breakdown of the component's internal structure with BEM class call-outs.

Anatomy of OrigamLabelSchematic of the Label component with 2 numbered internal parts. Label text * 1 2 origam-label sup · visible when required=true
Anatomy of <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. Accepts tag override.
2.origam-label sup
Required indicator <sup>*</sup>. Only rendered when required=true. Color driven by --origam-label---required-indicator-color.

API

Props

All props accepted by this component, with their type, default value and description.

text
string
Label text content. Can also be set via the default slot.
floating
boolean
false
Activates the floating label variant (smaller font-size, hidden by default until field activation).
required
boolean
false
Appends a <sup>*</sup> required indicator after the label text.
name
string
HTML name attribute forwarded to the root element.
id
string
class
string | Array<string> | object
style
string | Array<string> | object | StyleValue
margin
boolean | number | string
CSS margin shorthand applied via the margin composable.
marginTop
boolean | number | string
marginLeft
boolean | number | string
marginBottom
boolean | number | string
marginRight
boolean | number | string
marginBlock
boolean | number | string
marginInline
boolean | number | string
marginInlineStart
boolean | number | string
marginInlineEnd
boolean | number | string
marginBlockStart
boolean | number | string
marginBlockEnd
boolean | number | string
padding
boolean | number | string
CSS padding shorthand applied via the padding composable.
paddingTop
boolean | number | string
paddingLeft
boolean | number | string
paddingBottom
boolean | number | string
paddingRight
boolean | number | string
paddingBlock
boolean | number | string
paddingInline
boolean | number | string
paddingInlineStart
boolean | number | string
paddingInlineEnd
boolean | number | string
paddingBlockStart
boolean | number | string
paddingBlockEnd
boolean | number | string
border
boolean | number | string | TDirectionBoth | Array<TDirectionBoth>
false
Applies a border. Pass true for the default border or a CSS shorthand.
borderTop
boolean | number | string
borderLeft
boolean | number | string
borderBottom
boolean | number | string
borderRight
boolean | number | string
borderBlock
boolean | number | string
borderInline
boolean | number | string
borderInlineStart
boolean | number | string
borderInlineEnd
boolean | number | string
borderBlockStart
boolean | number | string
borderBlockEnd
boolean | number | string
borderColor
string
borderStyle
string
borderTopColor
TColor
borderRightColor
TColor
borderBottomColor
TColor
borderLeftColor
TColor
borderInlineStartColor
TColor
borderInlineEndColor
TColor
borderBlockStartColor
TColor
borderBlockEndColor
TColor
Border-radius token or boolean.
roundedTopRight
boolean | number | string
roundedTopLeft
boolean | number | string
roundedBottomLeft
boolean | number | string
roundedBottomRight
boolean | number | string
roundedStartStart
boolean | number | string
roundedStartEnd
boolean | number | string
roundedEndStart
boolean | number | string
roundedEndEnd
boolean | number | string
color
Foreground (text) color. Accepts semantic intents or a CSS color.
bgColor
Background color override.
tag
string
'label'
HTML element rendered at root. Defaults to <label>.
fontSize
TFontSize
fontWeight
TFontWeight
lineHeight
TLineHeight
letterSpacing
TLetterSpacing

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.

@click
MouseEvent
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

label (native HTML)

Keyboard interactions

Keyboard interactions
KeyAction
click on labelClicking 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.

Source
color
var(--origam-color__text---secondary)
Default label text color.
dimension
var(--origam-font__size---md)
Default font size.
fontWeight
var(--origam-font__weight---regular)
Label font weight.
duration
var(--origam-motion__duration---normal)
Duration of float animation transitions.
color
var(--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

vue

Required field

vue

Color variants

vue