npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@input-kit/number

v0.1.1

Published

Headless number input component with locale support, currency modes, and TypeScript

Readme

@input-kit/number

Headless number input component for React with locale support, currency formatting, and full TypeScript support.

Features

  • Headless - Bring your own styles
  • Locale-aware - Automatic number formatting for any locale
  • Currency support - Built-in currency formatting
  • Keyboard navigation - Arrow keys and Home/End support
  • Accessible - ARIA attributes and keyboard support
  • Tiny - Tree-shakeable, minimal dependencies
  • TypeScript - Full type safety

Installation

npm install @input-kit/number
# or
yarn add @input-kit/number
# or
pnpm add @input-kit/number

Quick Start

Using the Hook (Recommended)

import { useNumberInput } from '@input-kit/number';

function MyComponent() {
  const { inputProps, value, increment, decrement } = useNumberInput({
    defaultValue: 100,
    min: 0,
    max: 1000,
    step: 10,
  });

  return (
    <div>
      <input {...inputProps} className="my-input" />
      <button onClick={decrement}>-</button>
      <span>{value}</span>
      <button onClick={increment}>+</button>
    </div>
  );
}

Using the Component

import { NumberInput } from '@input-kit/number';

function MyComponent() {
  const [value, setValue] = useState<number | null>(100);

  return (
    <NumberInput
      value={value}
      onChange={setValue}
      min={0}
      max={1000}
      step={10}
      className="my-input"
    />
  );
}

Currency Formatting

const { inputProps, formattedValue } = useNumberInput({
  format: 'currency',
  currency: 'EUR',
  locale: 'de-DE',
});

// Displays: 1.234,56 €

Percentage Formatting

const { inputProps } = useNumberInput({
  format: 'percent',
  decimals: 1,
});

// Displays: 15.5%

API Reference

useNumberInput(options)

Options

| Option | Type | Default | Description | |--------|------|---------|-------------| | value | number \| null | - | Controlled value | | defaultValue | number \| null | null | Default value (uncontrolled) | | onChange | (value: number \| null) => void | - | Change handler | | min | number | - | Minimum value | | max | number | - | Maximum value | | step | number | 1 | Step increment | | decimals | number | - | Number of decimal places | | format | 'decimal' \| 'currency' \| 'percent' | 'decimal' | Format style | | currency | string | 'USD' | Currency code (for currency format) | | currencyDisplay | 'symbol' \| 'narrowSymbol' \| 'code' \| 'name' | 'symbol' | Currency display style | | locale | string \| string[] | Browser locale | Locale for formatting | | allowNegative | boolean | true | Allow negative numbers | | allowEmpty | boolean | true | Allow empty value | | formatter | (value: number \| null) => string | - | Custom formatter | | parser | (value: string) => number \| null | - | Custom parser |

Returns

| Property | Type | Description | |----------|------|-------------| | value | number \| null | Current numeric value | | formattedValue | string | Formatted display value | | inputValue | string | Raw input value | | isFocused | boolean | Whether input is focused | | isValid | boolean | Whether value is valid | | error | string \| null | Validation error message | | setValue | (value: number \| null) => void | Set value directly | | increment | () => void | Increment by step | | decrement | () => void | Decrement by step | | clear | () => void | Clear the input | | focus | () => void | Focus the input | | blur | () => void | Blur the input | | inputProps | object | Props to spread on input element |

NumberInput Component

All hook options plus standard input props:

  • className
  • placeholder
  • disabled
  • readOnly
  • name
  • id
  • aria-label
  • aria-labelledby

Keyboard Shortcuts

| Key | Action | |-----|--------| | | Increment by step | | | Decrement by step | | Home | Set to minimum (if defined) | | End | Set to maximum (if defined) |

License

MIT © Input Kit