Keypad
A number pad for amounts and PINs, with a decimal point or 000 and a darker delete key; it never mirrors.
Preview
Mirrored is the same English content laid out right to left: it separates a mirroring bug from a translation one.
PreviewCode
EnglishMirroredArabic
LTR →
Installation
Add the component
npx ritla add keypadAlso works with shadcn:
npx shadcn@latest add @ritla/keypadDependencies it brings
@phosphor-icons/reactOr copy by hand
Installing by hand copies the component's source into your project. The source comes with a Ritla UI license, so the CLI is the short way to the same files.
Usage
import { Keypad } from "@/components/ui/keypad";<Keypad onKey={(k) => setValue((v) => v + k)} onDelete={() => setValue((v) => v.slice(0, -1))} deleteLabel="Delete" />API reference
Keypad
| Prop | Type | Default | Description |
|---|---|---|---|
onKey | (key: string) => void | None | A key was pressed: 0 to 9, “.” or “000”. |
onDelete | () => void | None | The delete key. |
decimal | "dot" | "000" | "none" | "dot" | Figma's Decimal; none for PINs. |
deleteLabel | string | None | The delete key's name. |
disabled | boolean | None | Turns every key off. |
Accessibility
Keyboard
Keys are written for left-to-right. In right-to-left the arrow keys swap: the one pointing toward the reading direction moves forward.
| Key | Action |
|---|---|
| Tab | Moves from key to key in reading order. |
| EnterSpace | Presses the focused key. |
ARIA
- Every key is a button; the delete key is named by
deleteLabel. - Show what was typed in a live region above the pad.
Arabic and RTL notes
Mirrors
- Nothing.
Does not mirror
- The pad keeps a phone's layout (1 2 3 on top, delete at the bottom right) in Arabic too.
- Numerals
- The keys show the reader's digits: 1 or ١, from
numeralson RitlaProvider. - Arabic typography
numeric-24Semibold keys.