Label

Feedback & Status
stable

Form field label with required indicator and floating state support.

Aperçu

Rendu de l’aperçu en cours…

default

Rendu de l’aperçu en cours…

required

Rendu de l’aperçu en cours…

primary

Rendu de l’aperçu en cours…

danger

Structure

Anatomie

Décomposition visuelle de la structure interne du composant avec les appels de classes BEM.

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

Toutes les props acceptées par ce composant, avec leur type, valeur par défaut et 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

Emplacements de contenu exposés par ce composant.

#default
Main label content. Overrides the text prop. The required indicator <sup>*</sup> is appended after the slot when required=true.

API

Emits

Événements émis par ce composant.

@click
MouseEvent
Fired when the label element is clicked.

API

Membres exposés

Propriétés et méthodes accessibles via ref template (defineExpose). Utilisés pour le contrôle programmatique.

<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.

Personnalisation

Variables CSS

Propriétés CSS personnalisées exposées par ce composant. Surchargez-les pour personnaliser sans perdre la compatibilité avec le thème.

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

Accessibilité

Rôles ARIA, navigation clavier et gestion du focus. Sourcé depuis le template réel du composant.

Rôles ARIA

label (native HTML)

Interactions clavier

Interactions clavier
ToucheAction
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.

Fondation

Design tokens

Extrait des tokens de ce composant — les variables --origam-<composant>---<propriété>, déclarées dans sa feuille de tokens tenue à la main, sans étape de build.

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.

Interactif

Playground

Modifiez les props en direct et observez le composant se mettre à jour. Le snippet de code généré suit vos changements.

Rendu de l’aperçu en cours…

Usage

Exemples

Extraits de code prêts à coller dans vos templates.

Basic label

vue

Required field

vue

Color variants

vue