Skip to content

Number field

Accepts a number, with buttons to increase and decrease it.

number-field-basic-demo.tsx

Installation

The CLI adds the files, packages, theme variables, and Tailwind plugin that this component uses. Before you run it, set up your project.

Composition

  • NumberField

    Owns the value, limits, step, and number format.

    • NumberFieldLabel
    • NumberFieldGroup
      • NumberFieldDecrementOptional
      • NumberFieldInput
      • NumberFieldIncrementOptional
      • NumberFieldSteppersOptional

        Stacks both step buttons. Use it in place of NumberFieldDecrement and NumberFieldIncrement.

    • NumberFieldDescriptionOptional
    • NumberFieldError

Minimum and maximum

The step buttons stop at each limit.

Choose 1 to 10 members.
number-field-limits-demo.tsx

Currency formatting

Adjust the amount in steps of 100.
number-field-currency-demo.tsx

Stacked steppers

Each button is half the field height. On touch screens, use the split layout.

number-field-stacked-demo.tsx

Composition

Set a unit in formatOptions, so screen readers read the unit with the value.

From 10 GB to 500 GB.
number-field-composition-demo.tsx

Disabled

number-field-disabled-demo.tsx

Sizes

number-field-sizes-demo.tsx

API reference

vip/ui adds or changes the props below. For all other props, see React Aria NumberField (opens in a new tab).

size: "xs" | "sm" | "md" | "lg" | "xl" = "lg"
Sets the size of the field and of the step buttons.
steppers: "split" | "stacked" = "split"
Puts the step buttons on each side of the value, or stacks them at the end.
label: string
Label above the field.
description: string
Help text below the field.