VelocityUI logoVelocityUI

NumberInput

Numeric input with increment and decrement buttons. Respects min/max bounds and supports label, error, and hint text.

Import

tsx
import { NumberInput } from '@velocityuikit/velocityui'

Preview

Basic with bounds

Between 1 and 99

With error

Sizes

Props

PropTypeDefaultDescription
valuenumberControlled value.
onChange(value: number) => voidCallback fired when the value changes.
minnumberMinimum allowed value. Disables the decrement button at the boundary.
maxnumberMaximum allowed value. Disables the increment button at the boundary.
stepnumber1Amount to increment or decrement per button click.
labelstringLabel rendered above the input.
errorstringError message rendered below the input.
hintstringHint text rendered below the input when there is no error.
size'sm' | 'md' | 'lg''md'Height of the input.
disabledbooleanfalseDisables the input and buttons.

Examples

Basic

tsx
import { NumberInput } from '@velocityuikit/velocityui'
import { useState } from 'react'

export default function Example() {
  const [qty, setQty] = useState(1)
  return <NumberInput value={qty} onChange={setQty} min={1} max={99} label="Quantity" />
}

With error

tsx
import { NumberInput } from '@velocityuikit/velocityui'

export default function Example() {
  return (
    <NumberInput
      value={0}
      onChange={() => {}}
      min={1}
      label="Age"
      error="Must be at least 1"
    />
  )
}

Theming

Apply a named theme class to <body> or any parent element. All VelocityUI components inside that element will automatically adopt its colors, shadows, and effects. Combine with a density modifier for complete control:

css
/* Pick any named theme */
<body class="vui-theme-ocean">

/* Add a density modifier (optional) */
<body class="vui-theme-midnight vui-density-compact">
<body class="vui-theme-construction vui-density-spacious">

/* Available themes */
/* default  midnight  ocean  tangerine */
/* construction  glass  soft  high-contrast  monochrome-red */

/* Available densities */
/* vui-density-compact  vui-density-comfortable  vui-density-spacious */