On-Screen Keyboard

Pro

A full keyboard for touch screens with no physical one: a large display, letters, symbols, shift and a space bar, wired to a value you control.

Search products

Installation#

# One-time setup (tokens + lib helpers)npx koalaui-cli@latest init# Activate your Pro license (once per machine)npx koalaui-cli@latest login <key># Add this component (its dependencies come along)npx koalaui-cli@latest add on-screen-keyboard

Usage#

This example is part of Koala UI Pro

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. The display grows with the keyboard and never opens a device keyboard of its own. To drive a field elsewhere on the screen, leave the display out and set readOnly on that field. For digits only, use Keypad.

Anatomy#

import { OnScreenKeyboard, OnScreenKeyboardDisplay } from "@/components/ui/on-screen-keyboard"<OnScreenKeyboard>  <OnScreenKeyboardDisplay /></OnScreenKeyboard>

Sizes#

md suits a tablet in the hand, lg a till and xl a kiosk. Keys share the width they are given and stay square, so a wider keyboard means bigger targets. In a narrow container they keep the minimum height of their size.

Size md
Size xl

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.

Usuario

API reference#

OnScreenKeyboard

The keyboard. Keys type on touch, not on release, leave a short brand afterglow, and never take focus, so any field outside it keeps its focus ring and caret. Holding delete repeats it. Accepts className, merged last.

PropTypeDefaultDescription
valuestring-The text, controlled.
defaultValuestring""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.
lettersstring[]QWERTYOne string per row. QWERTY_ES adds the ñ.
symbolsstring[]SYMBOLSThe rows of the second layer.
size"md" | "lg" | "xl""lg"Minimum key height: 44, 56 or 64px. Keys turn square once the width allows it.
disabledbooleanfalseLocks every key.
enterLabelReactNode-Names what enter does here, such as Search. Falls back to the enter label.
Data attributeDescription
data-slot"on-screen-keyboard", with -row, -key, -shift, -delete, -layer, -space and -enter parts.
data-layer"letters" or "symbols".

OnScreenKeyboardDisplay

The text being typed, at the scale of the keys, with a clear button. Reads the value and size from the keyboard, follows the end of long text and announces changes. While someone types it holds the focus ring and a steady caret. Accepts className, merged last.

PropTypeDefaultDescription
placeholderstring-Shown while empty, and names the display for screen readers.
Data attributeDescription
data-slot"on-screen-keyboard-display", with -caret and -clear parts.
data-activePresent while someone is typing, and for two seconds after.

FAQ#

It matches how tills and kiosks are used: short values typed in order and corrected with delete. Moving a caret by finger on a small field is slower than retyping.