A number input with steppers, formatted for the reader
pnpm dlx shadcn@latest add https://notchset.dev/r/number-field.jsonA number typed or stepped, shown in the reader's format.
Every shadcn style · one file
Import it and pass your content. The props that matter most are listed next.
"use client";
import * as React from "react";
import { NumberField } from "@/components/ui/notchset/number-field";
/*
* Seats on a CRM plan, a deal's amount and a discount, as the billing and quote screens set them: each shows its
* value in the reader's format and the plain number while typing; the steppers and arrows move it, Shift moves ten,
* and dragging a label scrubs it. Past the plan's 50 seats it comes back to 50 and says so. The knobs set the format,
* the steppers (off: a plan row's estimate in days, typed or stepped with the arrows), a field at its limit (the plus goes quiet, the hint says where it stops) and a field that can't change.
*/
type Format = "number" | "money" | "percent";
export default function NumberFieldDemo() {
const format = "number" as Format;
const unavailable = false;
const atLimit = false;
const stepButtons = true;
const hint = "$12 a seat each month";
const [seats, setSeats] = React.useState<number | null>(12);
const [amount, setAmount] = React.useState<number | null>(125_000);
const [off, setOff] = React.useState<number | null>(0.1);
const [guests, setGuests] = React.useState<number | null>(50);
const [days, setDays] = React.useState<number | null>(5);
const common = { disabled: unavailable, reason: unavailable ? "Only the account owner changes the plan" : undefined };
return (
<div className="w-[var(--ns-width-sm)] max-w-full">
{!stepButtons ? (
<NumberField label="Estimate, days" min={1} max={99} stepButtons={false} value={days} onValueChange={setDays} hint="Whole days, 1 to 99" {...common} />
) : atLimit ? (
<NumberField label="Guest passes" min={0} max={50} value={guests} onValueChange={setGuests} hint="Up to 50 per workspace" {...common} />
) : format === "money" ? (
<NumberField label="Budget" format="money" currency="USD" step={100} largeStep={100_000} min={0} value={amount} onValueChange={setAmount} hint="Billed in USD" {...common} />
) : format === "percent" ? (
<NumberField label="Discount" format="percent" min={0} max={0.5} value={off} onValueChange={setOff} hint="Up to 50%" {...common} />
) : (
<NumberField label="Seats" min={1} max={50} value={seats} onValueChange={setSeats} hint={hint} {...common} />
)}
</div>
);
}"use client";
import * as React from "react";
import { NumberField } from "@/components/ui/notchset/number-field";
/*
* Seats on a CRM plan, a deal's amount and a discount, as the billing and quote screens set them: each shows its
* value in the reader's format and the plain number while typing; the steppers and arrows move it, Shift moves ten,
* and dragging a label scrubs it. Past the plan's 50 seats it comes back to 50 and says so. The knobs set the format,
* the steppers (off: a plan row's estimate in days, typed or stepped with the arrows), a field at its limit (the plus goes quiet, the hint says where it stops) and a field that can't change.
*/
type Format = "number" | "money" | "percent";
export default function NumberFieldDemo() {
const format = "number" as Format;
const unavailable = false;
const atLimit = false;
const stepButtons = true;
const hint = "$12 a seat each month";
const [seats, setSeats] = React.useState<number | null>(12);
const [amount, setAmount] = React.useState<number | null>(125_000);
const [off, setOff] = React.useState<number | null>(0.1);
const [guests, setGuests] = React.useState<number | null>(50);
const [days, setDays] = React.useState<number | null>(5);
const common = { disabled: unavailable, reason: unavailable ? "Only the account owner changes the plan" : undefined };
return (
<div className="w-[var(--ns-width-sm)] max-w-full">
{!stepButtons ? (
<NumberField label="Estimate, days" min={1} max={99} stepButtons={false} value={days} onValueChange={setDays} hint="Whole days, 1 to 99" {...common} />
) : atLimit ? (
<NumberField label="Guest passes" min={0} max={50} value={guests} onValueChange={setGuests} hint="Up to 50 per workspace" {...common} />
) : format === "money" ? (
<NumberField label="Budget" format="money" currency="USD" step={100} largeStep={100_000} min={0} value={amount} onValueChange={setAmount} hint="Billed in USD" {...common} />
) : format === "percent" ? (
<NumberField label="Discount" format="percent" min={0} max={0.5} value={off} onValueChange={setOff} hint="Up to 50%" {...common} />
) : (
<NumberField label="Seats" min={1} max={50} value={seats} onValueChange={setSeats} hint={hint} {...common} />
)}
</div>
);
}components/ui/notchset/number-field.tsx
LevelMolecule: made of atoms only.
Made ofField,Rolling number
Free, no account or key. One command for every shadcn style. With the @notchset registry added, @notchset/<name> works too.
Works with React 18.3 or 19 on Tailwind CSS v4, in any shadcn project. What's tested
pnpm add lucide-react@^1The CLI adds the styles to the CSS file named in components.json (tailwind.css). Check that it points at your global stylesheet, that the project uses Tailwind CSS v4, and that the file is imported in your root layout. Installed by hand: paste styles.css into that file.
label–
React.ReactNodewhat the number is, above the well ("Seats")
hint–
React.ReactNodea quieter line under the well; the limit is said here when a value is brought back to it
error–
React.ReactNodewhat is wrong, in the hint's place with a mark
value–
number | nullthe number (controlled); null is empty
defaultValuenull
number | nullthe number at first (uncontrolled)
onValueChange–
(value: number | null) => voidevery change: each step, and each commit of a typed draft
onKeyDown–
React.KeyboardEventHandler<HTMLInputElement>a key in the field, after its own keys are handled
onValueCommit–
(value: number | null) => voida settled value: Enter, leaving the field, or one step (save here, through an operation)
min–
numberthe lowest value; a lower one typed is clamped when the field commits
max–
numberthe highest value; a higher one typed is clamped when the field commits
step–
numberone step of the steppers and arrow keys; 1 by default (money: one minor unit is 1; percent: 0.01, one point)
largeStep–
numberShift, Page Up and Page Down; ten steps by default
format"number"
"number" | "money" | "percent"number (the default), money (minor units, with `currency`) or percent (a fraction)
currencyDEFAULT_CURRENCY
stringthe ISO currency with format money; USD by default
localeDEFAULT_LOCALE
stringthe locale its figures are written in
size"md"
"sm" | "md"sm beside a table's controls, md (the default) in a form
disabled–
booleancan't change; give `reason` to say why
reason–
stringwhy it can't change, with `disabled`: read in the hint's place
readOnly–
booleanreads as a number but can't change (no steppers)
stepButtonstrue
booleanthe - and + buttons; false where a narrow cell has no room (typing and the arrow keys still step)
name–
stringthe input's name in a form
aria-label–
stringthe accessible name when there is no label
labels–
Partial<NumberFieldLabels>its built-in words, English by default
Three usesseats on a plan · a deal's amount · a stage's probability
Give your coding assistant the Markdown guide instead of screenshots.
https://notchset.dev/api/mcp (setup)v1.2.0 · 2026-11-17
Ships field-parts.tsx (clearOfKeyboard, fieldSurface, useFocusRefused), which it now uses. Internal files split; installs smaller; no change to the piece's own API.
v1.1.0 · 2026-11-17
Ships motion.ts (EASE), which it now uses.
v1.0.0 · 2026-11-09
Released free with the Notchset system.