NumberInput

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

Preview

Live previewCustomize theme

Basic with bounds

Between 1 and 99

With error

Sizes

Import

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

Props

PropTypeDefaultDescription
valuenumber—Controlled value.
onChange(value: number) => void—Callback fired when the value changes.
minnumber—Minimum allowed value. Disables the decrement button at the boundary.
maxnumber—Maximum allowed value. Disables the increment button at the boundary.
stepnumber1Amount to increment or decrement per button click.
labelstring—Label rendered above the input.
errorstring—Error message rendered below the input.
hintstring—Hint 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:

html
/* 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  dark-cyan  tangerine */
/* construction  glass  soft  high-contrast  monochrome-red */

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