Field
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
Anatomy
Visual breakdown of the component's internal structure with BEM class call-outs.
<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
All props accepted by this component, with their type, default value and description.
- centerAffixbooleantrue
- When true, vertically centres the prepend/append inner icons relative to the field height.
- dirtybooleanfalse
- Forces the field into its "filled/dirty" state (label floats, clearable icon shown).
- disabledbooleanfalse
- Disables all interaction. Sets opacity to 0.5.
- errorstring | booleanfalse
- Error state. true = visual error (--error modifier). string = error AND becomes the inline message for consumers that display it (e.g. FileField dropzone).
- flatbooleanfalse
- Removes the box shadow on solo variants.
- inlinebooleanfalse
- Renders the field inline (display: inline-flex) instead of full-width.
- labelstring
- Floating label text. Floats above the field when focused or dirty.
- prefixstring
- Non-editable text shown before the input value (e.g. "$" or "https://").
- suffixstring
- Non-editable text shown after the input value (e.g. ".com" or "kg").
- persistentClearbooleanfalse
- Shows the clear icon even when the field is not focused.
- reversebooleanfalse
- Reverses the icon/input layout direction (RTL-like swap).
- singleLinebooleanfalse
- Prevents the label from floating — the placeholder is shown instead.
- requiredbooleanfalse
- Marks the field as required. Appends an asterisk to the label.
- idstring
- classstring | Array<string> | object
- stylestring | Array<string> | object | StyleValue
- Shows a progress loader at the bottom of the field.
- color
- Active (focused) border and label colour.
- tagstring
- loadingTextstring
- bgColor
- Field background colour (relevant for filled/solo variants).
- appendInnerAvatarstring
- appendInnerIcon
- Icon displayed inside the field after the input value.
- prependInnerAvatarstring
- prependInnerIcon
- Icon displayed inside the field before the input value.
- Icon shown in the clearable button.
- clearablebooleanfalse
- Shows a clear button when the field has a value.
- prependInnerAriaLabelstring
- appendInnerAriaLabelstring
- borderboolean | number | string | TDirectionBoth | Array<TDirectionBoth>
- 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
- focusedboolean
- Field density: compact, comfortable or default.
- textstring
- floatingboolean
- namestring
- marginboolean | number | string
- 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
- 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
- Border-radius override. true = theme default, pill = full round.
- roundedTopRightboolean | number | string
- roundedTopLeftboolean | number | string
- roundedBottomLeftboolean | number | string
- roundedBottomRightboolean | number | string
- roundedStartStartboolean | number | string
- roundedStartEndboolean | number | string
- roundedEndStartboolean | number | string
- roundedEndEndboolean | number | string
- fontSizeTFontSize
- fontWeightTFontWeight
- lineHeightTLineHeight
- letterSpacingTLetterSpacing
- activeboolean | IStateEffectConfig
- activeClassstring
- Visual style. Values: 'outlined' | 'underlined' | 'filled' | 'solo' | 'solo-filled' | 'solo-inverted' | 'plain'.
- elevationTElevation
- Height tier: x-small (28px), small, default (36px), large (44px), x-large (52px).
API
Slots
Content slots exposed by this component.
- #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
Events emitted by this component.
- @update:focusedany
- @focusFocusEvent
- Fired when the inner input receives focus.
- @blurFocusEvent
- Fired when the inner input loses focus.
- @click:appendInnerMouseEvent
- @click:prepend-innerMouseEvent
- Fired when the prepend-inner zone is clicked.
- @click:prependInnerMouseEvent
- @click:append-innerMouseEvent
- Fired when the append-inner zone is clicked.
- @click:clearMouseEvent
- Fired when the clear button is clicked.
- @update:activeany
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>
- 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.
Customisation
CSS variables
CSS custom properties exposed by this component. Override them to customise the component without losing theme compatibility.
- 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
Accessibility
ARIA roles, keyboard navigation and focus management. Sourced from the real component template.
Keyboard interactions
| Key | Action |
|---|---|
| Tab | Moves focus to the embedded input element (passed via #default slot). |
| Escape | Clears 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.
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.
- dimensionvar(--origam-radius---sm)
- Field corner radius (4px).
- colorvar(--origam-color__border---default)
- Default border colour.
- number0.38
- Border opacity at rest (translucent on inactive state).
- dimension16px
- Base input font size.
- dimension6px
- Block padding for size=default (36px control). Centres input text vertically.
- colorvar(--origam-color__feedback--danger---border)
- Border colour in error state.
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.
Field variants
Prefix / suffix / inner icons