shadimage
wds
componentnumber-input-experimentalsource: ok · hit

Number Input Experimental

An input that returns a number value and automatically handles invalid inputs. (Includes experimental support for all Shadcn icon libraries)

npx shadcn add "https://wds-shadcn-registry.netlify.app/r/number-input-experimental.json"
free

No selection tags yet — empty means no evidence, not lack of support.

Dependencies

Bundle weight · light

Registry dependencies

input

Files1 · source cached 10/9/2026, 2:40:14 PM

src/registry/experimental/items/number-input/components/number-input.tsx
import { Input } from "@/components/ui/input"
import { cn } from "@/lib/utils"
import { type ComponentProps } from "react"

export function NumberInput({
  onChange,
  value,
  ...props
}: Omit<ComponentProps<typeof Input>, "type" | "onChange" | "value"> & {
  onChange: (value: number | null) => void
  value: undefined | null | number
}) {
  return (
    <Input
      {...props}
      onChange={e => {
        const number = e.target.valueAsNumber
        onChange(isNaN(number) ? null : number)
      }}
      value={value ?? ""}
      type="number"
    />
  )
}

export function InputGroupNumberInput({
  className,
  ...props
}: React.ComponentProps<typeof NumberInput>) {
  return (
    <NumberInput
      data-slot="input-group-control"
      className={cn(
        "flex-1 rounded-none border-0 bg-transparent shadow-none focus-visible:ring-0 dark:bg-transparent",
        className,
      )}
      {...props}
    />
  )
}

More from wds

Browse all components in this library →