Field

Form & Input
stable

Shared form-field shell used by all input components (TextField, NumberField, PasswordField…). Provides the label, prefix/suffix, prepend/append-inner zones, loader, outline/underline rendering and error state. Not intended for direct use — consume through a specific input component.

Structure

Anatomie

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

Anatomy of OrigamFieldSchematic of the Field component with 7 numbered internal parts. __label (floating) loader (OrigamProgress) prepend prefix __input (#default slot) suffix clear append 1
Anatomy of <origam-field> — 7 internal zones. The field is a CSS Grid with columns: prepend-inner / input / clear / append-inner. Label floats above the top edge when active.
1.origam-field
Root grid container. display: grid; grid-template-areas: "prepend-inner field clear append-inner".
2.origam-field__overlay
Interaction scrim (hover/focus ripple). pointer-events: none.
3.origam-field__prepend-inner
Leading icon/avatar zone inside the field border.
4.origam-field__field
Input area containing label, prefix, #default slot and suffix.
5.origam-field__clearable
Clear icon button. Shown when clearable=true and field is dirty/focused.
6.origam-field__append-inner
Trailing icon/avatar zone inside the field border.
7.origam-field__loader
Progress bar at the bottom of the field. Rendered when loading is active and kind !== skeleton.

API

Props

Toutes les props acceptées par ce composant, avec leur type, valeur par défaut et description.

centerAffix
boolean
true
When true, vertically centres the prepend/append inner icons relative to the field height.
dirty
boolean
false
Forces the field into its "filled/dirty" state (label floats, clearable icon shown).
disabled
boolean
false
Disables all interaction. Sets opacity to 0.5.
error
string | boolean
false
Error state. true = visual error (--error modifier). string = error AND becomes the inline message for consumers that display it (e.g. FileField dropzone).
flat
boolean
false
Removes the box shadow on solo variants.
inline
boolean
false
Renders the field inline (display: inline-flex) instead of full-width.
label
string
Floating label text. Floats above the field when focused or dirty.
prefix
string
Non-editable text shown before the input value (e.g. "$" or "https://").
suffix
string
Non-editable text shown after the input value (e.g. ".com" or "kg").
persistentClear
boolean
false
Shows the clear icon even when the field is not focused.
reverse
boolean
false
Reverses the icon/input layout direction (RTL-like swap).
singleLine
boolean
false
Prevents the label from floating — the placeholder is shown instead.
required
boolean
false
Marks the field as required. Appends an asterisk to the label.
id
string
class
string | Array<string> | object
style
string | Array<string> | object | StyleValue
Shows a progress loader at the bottom of the field.
color
Active (focused) border and label colour.
tag
string
loadingText
string
bgColor
Field background colour (relevant for filled/solo variants).
appendInnerAvatar
string
appendInnerIcon
Icon displayed inside the field after the input value.
prependInnerAvatar
string
prependInnerIcon
Icon displayed inside the field before the input value.
clearIcon
'mdi-close-circle-outline'
Icon shown in the clearable button.
clearable
boolean
false
Shows a clear button when the field has a value.
prependInnerAriaLabel
string
appendInnerAriaLabel
string
border
boolean | number | string | TDirectionBoth | Array<TDirectionBoth>
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
focused
boolean
density
'default'
Field density: compact, comfortable or default.
text
string
floating
boolean
name
string
margin
boolean | number | string
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
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-radius override. true = theme default, pill = full round.
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
fontSize
TFontSize
fontWeight
TFontWeight
lineHeight
TLineHeight
letterSpacing
TLetterSpacing
active
boolean | IStateEffectConfig
activeClass
string
variant
'outlined'
Visual style. Values: 'outlined' | 'underlined' | 'filled' | 'solo' | 'solo-filled' | 'solo-inverted' | 'plain'.
elevation
TElevation
size
'default'
Height tier: x-small (28px), small, default (36px), large (44px), x-large (52px).

API

Slots

Emplacements de contenu exposés par ce composant.

#default
The native input element slot. Provides ref binding and focus handlers for wiring up a <input>, <textarea>, or custom control.
#loader
Custom loader shown at the bottom of the field when loading is active.
#label
Replaces the floating label with custom markup.
#floatingLabel
Replaces only the floated (above-field) label state.
#prefix
Replaces the prefix text with custom markup.
#suffix
Replaces the suffix text with custom markup.
#prependInner
Content placed inside the field before the input value.
#appendInner
Content placed inside the field after the input value.
#clear

API

Emits

Événements émis par ce composant.

@update:focused
any
@focus
FocusEvent
Fired when the inner input receives focus.
@blur
FocusEvent
Fired when the inner input loses focus.
@click:appendInner
MouseEvent
@click:prepend-inner
MouseEvent
Fired when the prepend-inner zone is clicked.
@click:prependInner
MouseEvent
@click:append-inner
MouseEvent
Fired when the append-inner zone is clicked.
@click:clear
MouseEvent
Fired when the clear button is clicked.
@update:active
any

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>
Filters and forwards a subset of props to the embedded input element.
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.
string
Secondary style ID used for variant-level scoped styles.

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.

Field corner radius. Overridden by the rounded prop.
Default outline/underline colour.
Border width for outlined/underlined variants.
Border opacity at rest. Transitions to 1 on focus.
Field text colour inherited by the input.
Input font size.
Opacity when disabled.
Duration for label float, border and opacity transitions.

Inclusion

Accessibilité

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

Interactions clavier

Interactions clavier
ToucheAction
TabMoves focus to the embedded input element (passed via #default slot).
EscapeClears the field when clearable=true and focus is inside the field.

Notes

  • The floating label is wired to the input via the id passed through the default slot props. Consumers must bind the id from slotProps to their <input> id attribute.
  • The aria-describedby attribute is provided through the default slot props and must be forwarded to the native <input> so screen readers read associated messages.
  • When error is truthy, the --error modifier class is applied. Consumers are responsible for adding aria-invalid="true" to the native input.
  • The required prop appends * to the label. The native required attribute must be added to the <input> element directly by the consuming component.

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
dimension
var(--origam-radius---sm)
Field corner radius (4px).
color
var(--origam-color__border---default)
Default border colour.
number
0.38
Border opacity at rest (translucent on inactive state).
dimension
16px
Base input font size.
dimension
6px
Block padding for size=default (36px control). Centres input text vertically.
color
var(--origam-color__feedback--danger---border)
Border colour in error state.

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.

Field variants

vue

Prefix / suffix / inner icons

vue