Skip to content

OrigamLabel ​

<OrigamLabel> is the inline label element used standalone or by <OrigamField> (where it drives the floating-label notch). It renders a <label> by default but accepts any tag, exposes a required star, and can be flagged floating so <OrigamField> can position it above an input.

Basic usage ​

vue
<template>
    <OrigamLabel text="Email" />
</template>

Required ​

vue
<template>
    <OrigamLabel text="Email" required />
</template>

The * indicator is theme-aware — its color comes from --origam-label---required-indicator-color.

Floating ​

floating is the state used by <OrigamField> to position the cloned label inside the input notch. Standalone, it just adds the origam-label--floating class — <OrigamField> (or your own SCSS) is in charge of the actual transform / positioning animation.

vue
<template>
    <OrigamLabel text="Email" floating />
</template>

Color ​

color and bgColor accept either a semantic intent ('primary', 'danger', 'success', …) or a raw CSS color. OrigamLabel runs both through useBothColor, so intents resolve to theme tokens — no :style workaround is needed.

vue
<template>
    <OrigamLabel text="Email" color="primary"/>
    <OrigamLabel text="Required" bg-color="danger"/>
</template>

What each form emits on the root element:

ValueClassInline style
color="primary"origam--color-primarycolor: var(--origam-color__action--primary---fgSubtle)
color="#ff00aa"—color: rgb(255, 0, 170)
bg-color="primary"origam--bg-primarybackground-color: var(--origam-color__action--primary---bg) plus the paired color: …---fg
bg-color="#ff00aa"—background-color: rgb(255, 0, 170) plus an auto-contrast color

An intent fills both the utility class and the inline declaration — that is deliberate on the foreground channel: a Vue scoped rule outranks a utility class, so only the inline declaration reliably paints (see the "Classes-first" note in the repo's CLAUDE.md). Setting the same intent on both channels (color="danger" bg-color="danger") swaps the foreground to the background's paired contrast token instead of a hue-on-hue pair.

To reach a token outside the intent scale, set the component variable directly — but leave color unset, since the prop's inline declaration outranks the SCSS rule that reads --origam-label---color:

vue
<template>
    <OrigamLabel text="Email" :style="{
        '--origam-label---color': 'var(--origam-color__text---primary)'
    }" />
</template>

Polymorphic tag ​

vue
<template>
    <OrigamLabel tag="span" text="Inline label" />
    <OrigamLabel tag="legend" text="Field-set legend" />
</template>

Slots ​

SlotSlot propsDescription
default—Replaces the inner content. Falls back to text + the * required indicator.
vue
<template>
    <OrigamLabel for="email">
        Email <em style="opacity: .6;">(optional)</em>
    </OrigamLabel>
</template>

Emits ​

EventPayloadDescription
clickMouseEventFires on label click. Native <label for> association still focuses the bound input — this event lets you intercept the click for analytics / custom handling.
vue
<template>
    <OrigamLabel text="Email" @click="onLabelClick" />
</template>

Props (interface) ​

ts
interface ILabelProps extends ICommonsComponentProps, IMarginProps,
    IPaddingProps, IBorderProps, IRoundedProps, IColorProps,
    ITagProps, ITypographyProps {
    text?: string
    floating?: boolean
    required?: boolean
    name?: string
}

interface ILabelEmits {
    (e: 'click', event: MouseEvent): void
}

Typography props (ITypographyProps) ​

PropTypeDefaultDescription
fontSizeTFontSize—Font size token. Sets --origam-label---font-size to var(--origam-font__size---{fontSize}) (xs · sm · md · lg · xl · 2xl · 3xl · 4xl · 5xl). When unset, the label keeps its theme font-size.
fontWeightTFontWeight—Font weight token. Sets --origam-label---font-weight to var(--origam-font__weight---{fontWeight}) (regular 400 · medium 500 · semibold 600 · bold 700 · extrabold 800 · black 900). When unset, the label keeps its theme font-weight.
lineHeightTLineHeight—Line-height token. Sets --origam-label---line-height to var(--origam-font__lineHeight---{lineHeight}) (none 1 · tight 1.25 · snug 1.375 · normal 1.5 · relaxed 1.625 · loose 2). When unset, the label keeps its theme line-height.
letterSpacingTLetterSpacing—Letter-spacing token. Sets --origam-label---letter-spacing to var(--origam-font__letterSpacing---{letterSpacing}) (tight · normal · wide · wider · widest). When unset, the label keeps its theme letter-spacing.

fontFamily was removed from ILabelProps (issue #501) — no rule in the label stylesheet reads --origam-label---font-family. A label is meant to inherit the family of the form it labels, which is a project-level setting configured once on OrigamApp.

Anatomy ​

html
<label class="origam-label [origam-label--floating]" id="…" name="…">
    <span>{{ text }}</span>
    <sup>*</sup>            <!-- when required -->
</label>

Design tokens consumed ​

<OrigamLabel> reads its variables from packages/ds/src/assets/css/tokens/light.css and dark.css (SCSS twins under packages/ds/src/assets/scss/tokens/). Override at the document root or via a :style binding to re-skin a single instance.

CSS variableToken reference
--origam-label---color{color.text.secondary}
--origam-label---font-size{font.size.md}
--origam-label---font-weight{font.weight.regular}
--origam-label---line-height{font.lineHeight.normal}
--origam-label---letter-spacing{font.letterSpacing.normal}
--origam-label---pointer-eventsnone
--origam-label---transition-duration{motion.duration.normal}
--origam-label---transition-easing{motion.easing.standard}
--origam-label__floating---font-size0.75em
--origam-label__floating---visibilityhidden
--origam-label---required-indicator-color{color.feedback.danger.fgSubtle}

The full list lives in packages/ds/src/assets/css/tokens/light.css and dark.css — grep for --origam-label.

Accessibility ​

  • Use tag="label" (default) and pair via for/id so screen-readers announce the label when the input is focused.
  • The * required indicator is decorative — also pass required / aria-required on the input itself.
  • When a label is purely visual (e.g. a chip caption) prefer tag="span" so it does not register as a form label.

Theming notes ​

  • Theme-aware out of the box — switching <html data-theme="…"> re-resolves the colors instantly.
  • A sub-tree can opt into a different theme via <OrigamThemeProvider>.
  • OrigamField — wraps an input + label and drives the float animation.
  • OrigamTitle — semantic heading element.