Skip to content

Number Input ​

A numeric text field with increment (+) and decrement (−) spin-buttons. Enforces min/max bounds, supports configurable step sizes, and integrates with HTML forms.

Min / Max / Step ​

Full width

Sizes ​

Full width

Colors ​

Full width

Variants ​

Full width

Disabled & Readonly ​

Full width

Outside Label ​

Set label-placement="outside" to render the label outside the control box, above the value.

Full width

Full Width ​

Add the fullwidth attribute to stretch the control to its container width.

Full width

Handling Change Events ​

html
<ore-number-input id="qty" label="Quantity" value="1" min="1" max="99"></ore-number-input>

<script type="module">
  import '@vielzeug/refine/number-input';

  document.getElementById('qty').addEventListener('change', (e) => {
    console.log('Value changed to:', e.currentTarget.value);
  });
</script>

API Reference ​

Attributes ​

AttributeTypeDefaultDescription
valuenumber | nullnullCurrent numeric value
minnumberN/AMinimum allowed value
maxnumberN/AMaximum allowed value
stepnumber1Increment / decrement step size
large-stepnumber10Step size for Page Up / Page Down keys
labelstringN/AVisible label text
label-placement'outside' | 'inset''outside'Label above the control or inset inside it
namestringN/AForm field name
placeholderstringN/APlaceholder text when empty
nullablebooleanfalseAllow an empty / null value
disabledbooleanfalseDisables the control
readonlybooleanfalsePrevents user edits
color'primary' | 'secondary' | 'info' | 'success' | 'warning' | 'error'N/AFocus ring and accent color
size'sm' | 'md' | 'lg''md'Component size
variant'solid' | 'flat' | 'bordered' | 'outline' | 'ghost''solid'Visual style variant
fullwidthbooleanfalseStretch to the full width of the container

Events ​

EventDetailDescription
change{ value: number | null }Fired when value is committed (blur / step)
input{ value: number | null }Fired on every keystroke

CSS Custom Properties ​

PropertyDescription
--number-input-heightControl height
--number-input-border-colorBorder color
--number-input-radiusBorder radius
--number-input-bgInput background
--number-input-btn-bgSpin-button background
--number-input-btn-hover-bgSpin-button hover background

Accessibility ​

The number input component follows WCAG 2.1 Level AA standards.

Keyboard navigation uses ↑ / ↓ to step the value by step, and Page Up / Page Down to step by large-step. Tab moves focus in and out of the control.

The label is linked via aria-labelledby, and helper or error text is linked via aria-describedby. Spin buttons carry aria-label values ("Increment" / "Decrement") and set aria-disabled when the value reaches min or max. The aria-invalid attribute reflects the error state, while aria-disabled and aria-readonly reflect the disabled and readonly states respectively.

  • Input: plain text / single-line input field
  • Slider: drag-based numeric value picker