NumberField

Form & Input
stable

Numeric input field with built-in increment/decrement controls, min/max/step clamping, precision formatting, hold-to-repeat, split layout, and full form validation support.

Preview

Rendering the live preview…

default

Rendering the live preview…

split

Rendering the live preview…

compact

Rendering the live preview…

disabled

Structure

Anatomy

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

Anatomy of OrigamNumberFieldSchematic of the NumberField component with 6 numbered parts. Quantity 5 + − origam-messages__message — hint text 1 2 3 4 5 6
Anatomy of <origam-number-field> — 6 parts: root field, input area, control container, increment button, decrement button, and messages/details row.
1.origam-number-field
Root OrigamField container. Holds the label, input area, and details zone.
2.origam-messages (details slot)
Details zone below the field — renders hint, error messages, and counter.
3.origam-number-field__control
Wrapper for the stacked or split increment/decrement buttons.
4.origam-number-field__compact-input
Compact-mode inner input shown between the stacked controls.
5increment button
Increment (+) button. aria-label="Increment". Disabled when value >= max.
6decrement button
Decrement (−) button. aria-label="Decrement". Disabled when value <= min.

API

Props

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

autofocus
boolean
false
Auto-focuses the input on mount.
placeholder
string
Placeholder text shown when the field is empty and not focused.
persistentPlaceholder
boolean
false
Keeps the placeholder visible even when the field is focused.
role
string
modelModifiers
string | boolean
inset
boolean
hideInput
boolean
false
Hides the text input, leaving only the increment/decrement controls visible.
modelValue
number | null
null
The current numeric value. Use v-model to bind two-way.
min
number
Minimum allowed value. Clamps the model and disables the decrement button when reached.
max
number
Maximum allowed value. Clamps the model and disables the increment button when reached.
step
number
1
Increment/decrement step size. Also used as the native <input type="number" step> attribute.
precision
number
Number of decimal places. When set, the displayed value is formatted with toFixed(precision).
incrementIcon
mdi-plus
Icon for the increment (+) control button.
decrementIcon
mdi-minus
Icon for the decrement (−) control button.
holdDelay
number
500
Milliseconds before hold-to-repeat starts when holding a control button.
holdRepeat
number
100
Interval in milliseconds between repeated increments/decrements during hold.
split
boolean
false
Places the decrement button to the left and increment button to the right of the input.
hideControls
boolean
false
Hides the increment/decrement control buttons entirely.
compact
boolean
false
Compact layout: buttons are stacked vertically to the right of the input.
decrementAriaLabel
string
incrementAriaLabel
string
centerAffix
boolean
dirty
boolean
disabled
boolean
false
Disables the field and all controls.
error
string | boolean
inline
boolean
label
string
Floating label text displayed above / inside the field.
prefix
string
suffix
string
persistentClear
boolean
singleLine
boolean
required
boolean
id
string
class
string | Array<string> | object
style
string | Array<string> | object | StyleValue
Shows a loading indicator inside the field.
color
TColor
tag
string
loadingText
string
bgColor
TColor
appendInnerAvatar
string
appendInnerIcon
Icon displayed inside the field, after the input (overridden by controls when hideControls=false).
prependInnerAvatar
string
prependInnerIcon
Icon displayed inside the field, before the input.
clearIcon
TIcon
clearable
boolean
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
TDensity
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
rounded
boolean | number | string | TRounded | null | undefined
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 variant: outlined, filled, underlined, solo, plain, ghost.
elevation
TElevation
size
TSize | number
hideDetails
boolean | string
hideSpinButtons
boolean
hint
string
Helper text shown below the field.
persistentHint
boolean
false
Keeps the hint text visible even when the field is not focused.
messages
Array<string> | string
height
number | string
maxHeight
number | string
maxWidth
number | string
minHeight
number | string
minWidth
number | string
width
number | string
direction
TDirection
errorMessages
Array<string> | string
[]
External error messages injected directly (e.g. from server validation).
maxErrors
number | string
readonly
boolean
false
Makes the field read-only. Controls are hidden in readonly mode.
rules
Array<any>
[]
Validation rules. Each rule is a function receiving the value and returning true or an error string.
validateOn
TValidateOn
validationValue
any
appendAvatar
string
appendIcon
Icon displayed outside and after the field.
prependAvatar
string
prependIcon
Icon displayed outside and before the field.
prependAriaLabel
string
appendAriaLabel
string

API

Slots

Content slots exposed by this component.

#field
Replaces the entire field control area.
#increment
Custom increment button. Receives handler functions and the canIncrease state.
#decrement
Custom decrement button. Receives handler functions and the canDecrease state.
#default
Replaces the internal <input> element. Useful for custom input rendering.
#loader
Custom loading indicator shown when loading=true.
#label
Custom label content replacing the default floating label.
#floatingLabel
#prefix
#suffix
#prependInner
Content placed inside the field, before the input.
#appendInner
#clear
#details
Replaces the entire details area (messages + counter).
#prepend
Content placed outside and before the field.
#append
Content placed outside and after the field.
#messages
Custom message renderer below the field.
#message

API

Emits

Events emitted by this component.

@click:control
MouseEvent
Fired when either the increment or decrement button is clicked.
@mousedown:control
MouseEvent
Fired on pointerdown on a control button (used to start hold-to-repeat).
@click:clear
MouseEvent
Fired when the clear button is clicked (clearable=true).
@increment
number | null
Fired after each increment step, carrying the new value.
@decrement
number | null
Fired after each decrement step, carrying the new value.
@update:focused
any
@click:appendInner
MouseEvent
@click:prependInner
MouseEvent
@update:modelValue
any
Two-way binding for the numeric value. Fired on each change.
@click:append
MouseEvent
@click:prepend
MouseEvent

Customisation

CSS variables

CSS custom properties exposed by this component. Override them to customise the component without losing theme compatibility.

Field background color.
Field text color.
Default border color. Overridden to focus / error variants on interaction.
Border-radius of the field container.
Opacity applied when disabled=true.
Background of the increment button on hover.
Background of the decrement button on hover.

Inclusion

Accessibility

ARIA roles, keyboard navigation and focus management. Sourced from the real component template.

ARIA roles

group
spinbutton

Keyboard interactions

Keyboard interactions
KeyAction
ArrowUpIncrements the value by step.
ArrowDownDecrements the value by step.
TabMoves focus to the next interactive element (input → increment → decrement).

Notes

  • The control container has role="group" and aria-label matching the field label, grouping the input + buttons semantically.
  • Increment and decrement buttons have aria-label="Increment" and aria-label="Decrement" respectively. They also have aria-hidden="true" on their icon children.
  • When value reaches min or max, the corresponding button is disabled (pointer-events: none, aria-disabled="true").

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

vue

Split layout

vue

Compact stacked controls

vue