"use client";
import { Keypad } from "@pixxl-tools/components";| Prop | Type | Default | Description |
|---|---|---|---|
keyboard | boolean | "global" | true | Physical keyboard shortcuts: true (default) while focus is inside the pad; "global" also while focus is elsewhere on the page — on the body, or on a button, radio, checkbox, link or slider outside the pad (it keeps Space, Escape, Tab and the arrow/Home/End/Page keys; buttons and links also keep Enter, radios, checkboxes, switches and sliders do not) — but never while a text field, select, editable content, combobox, spin button, listbox, menu, tree, grid or another pad has focus, inside a dialog the pad is not in, or during IME composition; false off. After digits were typed (shortcuts) and before focus moves again, Enter submits them (presses the enter key) wherever focus is, also on a focused key of the pad, instead of activating the focused control. |
maxLength | number | — | Longest text. |
onSubmit | (value: string) => void | — | The enter key was pressed. |
onValueChange | (value: string) => void | — | Called with the new value (only when it changes). |
size | "sm" | "md" | "lg" | md | Minimum key height (default md): sm 44 px (--pixxl-size-touch-target, for small phones and landscape), md 56 px, lg 64 px. Tune it with the --pixxl-keypad-key-min custom property on the pad (never below 44 px); give the pad a height and the rows grow to fill it. |
value | string | — | Typed text: digits append, backspace deletes, clear empties. |
backspaceLabel | string | — | Override labels. |
columns | number | 3 | Grid columns (default 3); keys can span several. |
defaultValue | string | — | Initial value when uncontrolled. |
disabled | boolean | — | Disables interaction. |
keyboarddefault trueboolean | "global"
Physical keyboard shortcuts: true (default) while focus is inside the pad; "global" also while focus is elsewhere on the page — on the body, or on a button, radio, checkbox, link or slider outside the pad (it keeps Space, Escape, Tab and the arrow/Home/End/Page keys; buttons and links also keep Enter, radios, checkboxes, switches and sliders do not) — but never while a text field, select, editable content, combobox, spin button, listbox, menu, tree, grid or another pad has focus, inside a dialog the pad is not in, or during IME composition; false off. After digits were typed (shortcuts) and before focus moves again, Enter submits them (presses the enter key) wherever focus is, also on a focused key of the pad, instead of activating the focused control.
maxLengthnumber
Longest text.
onSubmit(value: string) => void
The enter key was pressed.
onValueChange(value: string) => void
Called with the new value (only when it changes).
sizedefault md"sm" | "md" | "lg"
Minimum key height (default md): sm 44 px (--pixxl-size-touch-target, for small phones and landscape), md 56 px, lg 64 px. Tune it with the --pixxl-keypad-key-min custom property on the pad (never below 44 px); give the pad a height and the rows grow to fill it.
valuestring
Typed text: digits append, backspace deletes, clear empties.
backspaceLabelstring
Override labels.
columnsdefault 3number
Grid columns (default 3); keys can span several.
defaultValuestring
Initial value when uncontrolled.
disabledboolean
Disables interaction.
Type digits, Backspace, Enter; Tab in, then arrow keys
const [value, setValue] = useState("");
const save = (code: string) => console.log(code);
<Keypad value={value} onValueChange={setValue} maxLength={3} onSubmit={save} keyboard="global" size="sm" />