Theme
Install with your agentnpx shadcn@4.23.1 add @goop/meadow-number-input

Number input

Free

A field for a number, an amount or a quantity, typed in the reader's language or stepped with the arrow keys, for React and Tailwind CSS. Free, MIT.

Step the quantities with their − and + buttons (hold one to repeat) or the arrow keys (Shift for ten), PageUp/PageDown, Home and End; type more than is left and leave the field to see it marked and brought back; type a credit in euros. The total follows. Nothing is bought; the prices and seats are our own sample.

When to use

  • A field for a number, an amount or a quantity, typed in the reader's language or stepped with the arrow keys.
  • Also called: spin button or quantity input.

Installation

Paste the prompt below into your coding agent. It reads Goop's install steps, installs the part and its tokens once, then reuses this same Number input on every screen instead of drawing a new one: the same height, the same focus ring, the same spacing.

Terminal
npx shadcn@4.23.1 add @goop/meadow-number-input
PROMPT
Add the Goop Number input to this project. The install steps are at https://goop.so/docs/install.md

Usage

TSX
import { useState } from 'react';
import { Field } from '@/components/ui/goop/field';
import { NumberInput, NumberInputAddon } from '@/components/ui/goop/number-input';

function Seats() {
  const [seats, setSeats] = useState<number | null>(3);
  return (
    <Field label="Team seats" orientation="vertical" className="w-full">
      <NumberInput name="seats" value={seats} onValueChange={setSeats} min={1} max={20} stepper>
        <NumberInputAddon side="end">seats</NumberInputAddon>
      </NumberInput>
    </Field>
  );
}
  • Also known as: Input type="number", NumberField, CurrencyInput, Spinbutton.
  • It is as wide as its container, up to 340 px: in a table cell, a grid track or a box with a width it takes that width down to 68 px, so in a 96 px column it is 96 px and never covers the next column; beside a Field row's words it is 180 px. Give its column the room the number needs; write no width class. width="fixed" keeps it 180 px at every width (a form's column of equal fields). For a quantity bought in packs, stepper step={12} min={0} snap draws − and + that move one case of 12 and bring a typed 13 to 12, so write no buttons of your own beside it. An editable quantity in a table row is the field straight in its cell, named by its row (aria-label="Order quantity of …").
  • height, width, padding, gap, background, text: add no class for these.

API reference

Options
OptionTypeWhat it does
DefaultsinputMode = 'decimal'
Parts
PartWhat it is
NumberInputAddonWords beside a NumberInput's digits, inside its frame; side: start (default), end
  • Class recipes (cva): numberInputAddonVariants (NumberInputAddon)
  • data-slot values (to select a part by): number-input, number-input-addon, number-input-control, number-input-frame

NumberInput: every option

TSX
import { NumberInput } from '@/components/ui/goop/number-input';

Options

  • value?: number | null — The number, controlled: null for an empty field.
  • defaultValue?: number | null — The number at first, uncontrolled (empty if left out).
  • onValueChange?: (value: number | null) => void — Called with each number typed in range or stepped, null when emptied.
  • min?: number — The lowest number; a lower one is marked invalid, then raised to it.
  • max?: number — The highest number; a higher one is marked invalid, then lowered to it.
  • step?: number = 1 — How far an arrow key or a stepper button moves the number; Shift, PageUp and PageDown move ten.
  • stepper?: boolean = false — Draws a − and a + button at the frame's ends, each moving the number one step and repeating while held.
  • snap?: boolean = false — Brings a typed number to the nearest step when it is kept.
  • decreaseLabel?: string = 'Decrease' — The − button's spoken name.
  • increaseLabel?: string = 'Increase' — The + button's spoken name.
  • currency?: string — An amount in this currency, an ISO 4217 code ("EUR").
  • locale?: string — The language of the numbers (a BCP 47 tag); the reader's own if left out.
  • format?: (value: number) => string — How the number reads at rest and when spoken ("60%"); grouped digits by default.
  • numeric?: boolean — Lays the digits at the field's end, for a column of amounts.
  • width?: 'fill' | 'fixed' = 'fill' — fill: its container's width, 68 to 340 px (a table cell's whole width).
  • children?: ReactNode — Words beside the digits: NumberInputAddon parts (a unit, a sign).
  • Also takes: onChange?: (event: ChangeEvent<HTMLInputElement>) => void; name?: string; required?: boolean; disabled?: boolean; form?: string
  • Defaults: inputMode = 'decimal'
  • State: value (value / defaultValue / onValueChange)

Keyboard

KeyWhat it does
ArrowUp ArrowDownRaise or lower the number by one step; with Shift, ten steps
PageUp PageDownRaise or lower the number by ten steps
HomeSet the lowest number, where one is set
EndSet the highest number, where one is set
EnterKeep the typed number, brought inside the range

Accessibility

  • The native element answers the keyboard.
  • hover, focus-visible: the browser's own (:hover, :focus-visible): write nothing

Its states are drawn from attributes and props, so assistive technology and your agent read the same thing:

StateDrawn by
disabledthe prop disabled

Notes for AI

Give your coding agent this page as text instead of screenshots: the parts, the options, the states and the keys. An agent that reads the real part builds the real part, not a lookalike.

goop.so/themes/meadow/components/number-input.md · the page as Markdown
Theme
Install with your agentnpx shadcn@4.23.1 add @goop/meadow-number-input

Where would you like to start?

Free · now

The Goop plugin

A design system for your AI coding agent, so screen ten matches screen one.

/plugin marketplace add goop-so/skillsthen /plugin install goop@goopCodex, Cursor, ChatGPT, the Claude app and more: Connect Goop
FreePro

The components

Every part live, with its props, its keys and what an agent sees. Whole page and app templates, working with sample data.