Number Stepper

Spinbutton with −/+ controls whose digits roll in the direction of change, press-and-hold repeat that accelerates, direct typing, arrow/Page/Home/End keys, min/max/step with a shake when pushed past a bound, and Intl.NumberFormat formatting; controlled/uncontrolled.

Preview

Number Stepper preview width

Install

Add it with the shadcn CLI, or copy the source manually.

$ bunx --bun shadcn add @karaui/number-stepper
@karaui not found? Add it to components.json
{
  "registries": {
    "@karaui": "https://karaui.kamisama-v0.my.id/r/{name}.json"
  }
}

@karaui is in shadcn's public registry directory, so the latest CLI needs no setup. On an older CLI, merge this into the existing file once and every @karaui/… install resolves.

API Reference

value?
number

Controlled value.

—
defaultValue?
number

Uncontrolled initial value. Default `min` when finite, else 0.

—
onChange?
((value: number) => void)
—
min?
number

Default 0.

0
max?
number

Default Infinity.

Number.POSITIVE_INFINITY
step?
number

Default 1.

1
largeStep?
number

PageUp/PageDown stride. Default `step * 10`.

—
formatOptions?
NumberFormatOptions

Display formatting, e.g. `{ style: "currency", currency: "USD" }`.

—
locale?
string

Formatting locale. Fixed default so server and client render the same text.

en-US
label?
string

Visible label above the control.

—
aria-label?
string
—
disabled?
boolean
false
className?
string
—

Updated