---
title: "Number Pad"
description: "A large keypad for typing numbers on a touch screen. It sends digits, the decimal key of the locale, and delete to the field it drives."
url: https://gelatinui.com/components/number-pad
markdown_url: https://gelatinui.com/components/number-pad.md
access: pro
install: "npx shadcn@latest add @gelatin-ui-pro/number-pad"
version: "2026-11-12"
index: https://gelatinui.com/llms.txt
docs_index: https://gelatinui.com/docs/llms.txt
---

# Number Pad

> A large keypad for typing numbers on a touch screen. It sends digits, the decimal key of the locale, and delete to the field it drives.

Page: https://gelatinui.com/components/number-pad

## When to use it

Best for: Typing an amount or a PIN on a touch screen, with big keys and no system keyboard.

- Use it under an amount on a phone, where the system keyboard covers the screen.
- Keep the value in your own state and apply each key with `applyNumberPadKey`.
- Pass `blockedNumberPadKeys` to `disabledKeys`, so keys that do nothing now show as off.

## When not to use it

- For an amount typed on a desktop keyboard, use a [Currency Input](https://gelatinui.com/components/currency-input.md).
- For a short code in boxes, use an [Input OTP](https://gelatinui.com/components/input-otp.md).

## Notes for agents

- The pad owns no value: `onKey` gets a digit, `decimal`, `delete`, or `clear`. Apply it to your text with `applyNumberPadKey(text, key, { decimals })`.
- `locale` sets the decimal key: `.` in en-US, `,` in de-DE. `decimal={false}` hides the key for a PIN and keeps its place.
- A short press on delete sends `delete`; a hold of 450ms or more sends `clear`.
- One tab stop: the arrow keys move between keys and skip keys that are off. Typed digits, `.`, `,`, Backspace, and Delete press the same keys.
- Pass `NumberPadKey` children to change the keys or their faces.

## Anatomy

```text
NumberPad
└─ NumberPadKey (0..n)
```

## API reference

### NumberPad

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `disabled` | `boolean` | false | Turn the whole pad off (a swap in flight). |
| `size` | `"default" \| "sm"` | "default" |  |
| `onKey` | `function` |  | Called with each key: a digit, `decimal`, `delete`, or `clear` (a held delete, or the Delete key). The pad owns no value: apply the key to your own value (`applyNumberPadKey`). |
| `locale` | `string` |  | The locale of the decimal key: `.` in en-US, `,` in de-DE. Default `"en-US"`. |
| `decimal` | `boolean` | true | Show the decimal key. `false` for a PIN or whole units: its place stays empty. Default `true`. |
| `disabledKeys` | `Iterable<NumberPadKeyName>` |  | Keys that do nothing now (`blockedNumberPadKeys`): no decimals left, nothing to delete. |
| `children` | `ReactNode` |  | The keys. Default: the 12 keys of a phone pad. |

### NumberPadKey

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `children` | `ReactNode` |  | The face. Default: the digit, the locale decimal sign, or the delete icon. |
| `value` | `NumberPadKeyName` |  | The key this button sends. |

## Styling

| Part | Slot | States | CSS variables | Tokens |
| --- | --- | --- | --- | --- |
| NumberPad | `number-pad` | `data-disabled`, `data-hidden`, `data-pressed` |  | `motion-timing` |
| NumberPadKey | `number-pad-key` | `data-disabled`, `data-hidden`, `data-pressed` |  | `motion-timing` |

## Usage

Render one key for each name of the layout, and apply each key to your own text with `applyNumberPadKey`.

```tsx title="amount-pad.tsx"
import { useState } from "react";

import { NumberPad, NumberPadKey } from "@/components/ui/pro/number-pad";
import {
  NUMBER_PAD_LAYOUT,
  applyNumberPadKey,
  blockedNumberPadKeys,
} from "@/lib/pro/number-pad-model";

const EURO = { decimals: 2 };

export function AmountPad() {
  const [text, setText] = useState("");
  return (
    <div className="flex flex-col gap-3">
      <p className="text-3xl tabular-nums">€{text === "" ? "0" : text}</p>
      <NumberPad
        disabledKeys={blockedNumberPadKeys(text, EURO)}
        onKey={(key) => {
          setText((current) => {
            return applyNumberPadKey(current, key, EURO).text;
          });
        }}
      >
        {NUMBER_PAD_LAYOUT.map((key) => {
          return <NumberPadKey key={key} value={key} />;
        })}
      </NumberPad>
    </div>
  );
}
```

## Compose

Rules:

- Compose the parts (`compose-parts`): Build each item from its named parts as children, and pass your text and icons in as parts.
- Every state is designed (`every-state`): Give each view of data its loading, empty, and error states: a skeleton in the final layout, an `Empty` with an illustration and one next action, and an error that says what failed and how to retry.

## Add it

```bash
npx shadcn@latest add @gelatin-ui-pro/number-pad
```

It adds 10 registry items: 9 files, 2590 lines, and the npm packages `@phosphor-icons/react`, `clsx`, `tailwind-merge`, `tailwind-variants`.

## For AI agents

- Every item, one file: https://gelatinui.com/llms.txt
- MCP server (`search_items`, `get_item`, `get_install_plan`): https://gelatinui.com/mcp

## Related

- [Currency Input](https://gelatinui.com/components/currency-input.md)
- [Input OTP](https://gelatinui.com/components/input-otp.md)
- [Currency Swap](https://gelatinui.com/components/currency-swap.md)

## Keyboard

| Keys | Action |
| --- | --- |
| Arrow keys | Move between keys; keys that are off are skipped. |
| 0-9, period, comma | Press the digit or the decimal key. |
| Backspace | Press delete. |
| Delete | Press clear. |

## Motion

| Part | Motion |
| --- | --- |
| Press | press · the key fills and scales to 0.96 |
