On-Screen Keyboard
ProA full keyboard for touch screens with no physical one: letters, symbols, shift and a space bar, wired to a value you control.
Installation#
Usage#
The preview is yours to explore. Its code comes with a Pro license, paid once and used in every project.
Have a license? Unlock it here
It types at the end of the value. Pair the field with readOnly so a phone or tablet does not also open its own keyboard. For digits only, use Keypad.
Sizes#
md suits a tablet in the hand, lg a till and xl a kiosk. Keys share the width they are given, so the keyboard fills its container on every screen.
Layouts and languages#
Rows are plain strings, so any layout is one array away. QWERTY_ES ships with the ñ, and the words on the keys come from LabelsProvider.
API reference#
OnScreenKeyboard
The keyboard. Keys never take focus, so a field keeps its focus ring and caret while someone types. Accepts className, merged last.
| Prop | Type | Default | Description |
|---|---|---|---|
| value | string | - | The text, controlled. |
| defaultValue | string | "" | The text when uncontrolled. |
| onValueChange | (value: string) => void | - | Called on every key that changes the text. |
| onEnter | (value: string) => void | - | Called by the enter key. |
| letters | string[] | QWERTY | One string per row. QWERTY_ES adds the ñ. |
| symbols | string[] | SYMBOLS | The rows of the second layer. |
| size | "md" | "lg" | "xl" | "lg" | Key height: 44, 56 or 64px. |
| disabled | boolean | false | Locks every key. |
| enterLabel | ReactNode | - | Names what enter does here, such as Search. Falls back to the enter label. |
| Data attribute | Description |
|---|---|
| data-slot | "on-screen-keyboard", with -row, -key, -shift, -delete, -layer, -space and -enter parts. |
| data-layer | "letters" or "symbols". |