Number Field

A numeric input element with increment and decrement buttons, and a scrub area.

API Reference

Installation

npx love-ui@latest add number-field

Usage

import {
  NumberField,
  NumberFieldDecrement,
  NumberFieldGroup,
  NumberFieldIncrement,
  NumberFieldInput,
  NumberFieldScrubArea,
} from "@/components/ui/number-field"
<NumberField defaultValue={0}>
  <NumberFieldScrubArea label="Quantity" />
  <NumberFieldGroup>
    <NumberFieldDecrement />
    <NumberFieldInput />
    <NumberFieldIncrement />
  </NumberFieldGroup>
</NumberField>

Examples

For accessible labelling and validation, prefer using the Field component to wrap number fields. See the related example: Number field.

Small Size

Large Size

Disabled

With External Label

With Scrub

With Range

With Formatted Value

With Step

Form Integration