8.4k

Number Field

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

API Reference

Installation

pnpm dlx shadcn@latest add https://coss.com/ui/r/number-field.json

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

coss.com ui

Built by and for the team of Cal.com, Inc. — the leading commercial open source company (“coss”).