Aurora Number Input
aurora-dinglebear-ai/aurora-number-inputUnverifiedComponent
Numeric stepper input with decrement and increment controls for tuning settings.
Install it
npx shadcn@latest add https://raw.githubusercontent.com/dinglebear-ai/aurora/main/aurora-number-input.jsonSource
1"use client"23/**4 * Aurora NumberInput — stepper control (decrement · value · increment).5 *6 * Visual layer is ported from the Claude Design source so it renders7 * pixel-identical in dark + `.light`: square 32px neutral stepper buttons8 * flanking a lit, accent-ringed center field that holds the value. The9 * CSS reads only `--aurora-*` tokens.10 *11 * Architecture stays shadcn-compatible: controlled/uncontrolled value,12 * `min`/`max`/`step` clamping, `onValueChange`, `forwardRef`, `displayName`,13 * full native input prop pass-through, and a11y labels on the steppers.14 */1516import * as React from "react"17import { Minus, Plus } from "lucide-react"18import { Button } from "./button"19import { Input } from "./input"2021export interface NumberInputProps22 extends Omit<React.InputHTMLAttributes<HTMLInputElement>, "type" | "value" | "defaultValue" | "onChange" | "size"> {23 value?: number24 defaultValue?: number25 min?: number26 max?: number27 step?: number28 onValueChange?: (value: number) => void29}3031// Styles: registry/aurora/styles/aurora-components.css (@layer aurora-components).3233function NumberInput({ ref, value, defaultValue = 0, min, max, step = 1, onValueChange, className, ...props }: NumberInputProps & { ref?: React.Ref<HTMLInputElement> }) {34 const controlled = value !== undefined35 const [internalValue, setInternalValue] = React.useState(defaultValue)36 const current = controlled ? value : internalValue3738 function clamp(next: number) {39 if (min !== undefined && next < min) return min40 if (max !== undefined && next > max) return max41 return next42 }4344 function commit(next: number) {45 const clamped = clamp(next)46 if (!controlled) setInternalValue(clamped)47 onValueChange?.(clamped)48 }4950 return (51 <div className="aurora-number-input">52 <Button53 type="button"54 variant="neutral"55 size="sm"56 aria-label="Decrease value"57 onClick={() => commit(current - step)}58 disabled={props.disabled || (min !== undefined && current <= min)}59 style={{ width: 32, height: 32, padding: 0, borderRadius: 9 }}60 >61 <Minus className="size-3.5" aria-hidden />62 </Button>63 <Input64 ref={ref}65 unstyled66 type="number"67 value={current}68 min={min}69 max={max}70 step={step}71 onChange={(event) => commit(Number(event.target.value))}72// … truncated
What it pulls in
npm packages
Other registry items
Files it writes
More from aurora
All 176 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| Aurora Accordionaurora-accordion | aurora | Components | Unverified | 2 deps | |
| Aurora Alert Dialogaurora-alert-dialog | aurora | Components | Unverified | 2 deps | |
| Aurora Aspect Ratioaurora-aspect-ratio | aurora | Components | Unverified | no deps | |
| Aurora Avataraurora-avatar | aurora | Components | Unverified | 1 dep | |
| Aurora Badgeaurora-badge | aurora | Components | Unverified | 2 deps | |
| Aurora Banneraurora-banner | aurora | Components | Unverified | 1 dep | |
| Aurora Breadcrumbaurora-breadcrumb | aurora | Components | Unverified | 2 deps | |
| Aurora Buttonaurora-button | aurora | Components | Unverified | 2 deps |
