React virtual keyboard (on-screen keyboard) with Korean Hangul composition, plus English, number and phone keypads
A React virtual keyboard component for kiosks, PIN pads and touch web apps that solves Hangul composition on an on-screen keyboard. Pressing jamo builds the syllable right away with no candidate picking, and deleting, moving the caret and undoing during composition behave like a real Korean input method. Syllable assembly uses Toss's es-hangul; this library handles the editing behavior and keypads on top of it.
- Composes as you type. Pressing
ㄱ,ㅏ,ㄴputs간straight into the input. simple-keyboard's Korean layout makes you pick the finished syllable from a candidate box. - Deleting during composition removes one jamo.
간becomes가; the whole syllable is not lost. - One syllable is one undo step, not one step per jamo.
- A real
<input>.inputMode="none"only suppresses the system keyboard; caret, selection, long-press and the copy menu are the browser's own. Forms, accessibility tools and automated tests treat it as a normal input. - Input rules cover paste too.
filterKey,sanitizeValueandmaxLengthapply to keys and paste alike, and an overflowing edit is rejected instead of deleting trailing text. - No clash with app CSS. The keypad is drawn as
<button>s inside a Shadow DOM.
VirtualInputProviderandVirtualInput, plus the typesInputMode,InputPolicy,Key,KeypadLayout- Input modes:
text,hangul,number,tel,alpha,alphanumeric,custom - Korean two-set input with Korean/English switching
- QWERTY, number and phone keypads, symbol and edit screens
- Custom keypads from layout JSON, including multi-character macro keys
filterKey,sanitizeValueandmaxLengthfor typing and pasting- A real
<input inputMode="none">; the browser handles the caret and selection - A keypad of
<button>elements inside a Shadow DOM - Per-input undo and redo (up to 100 entries); copy, cut and paste buttons
- Physical keyboard input, light and dark themes, keypad visibility (
auto,always,never), Korean or English labels (locale) - TypeScript types included, ESM package
- Not tested with VoiceOver or TalkBack. Only automated axe checks pass
- No
type="password", autofill or form submission throughname - Single-line input only. No multi-line field
- No Korean layouts other than two-set, such as Cheonjiin
- Does not replace the operating system IME
numbermode is a character filter. Decimal count, sign and range checks are left to the app- Suppressing the system keyboard with
inputMode="none"differs across browsers and devices - Mobile detection is a heuristic. Set
keyboardVisibilityexplicitly for fixed behavior - No framework-agnostic core for non-React frameworks
npm install @uiwwsw/virtual-keyboardRequires React and React DOM 18 or 19.
"use client";
import { useState } from "react";
import { VirtualInput, VirtualInputProvider } from "@uiwwsw/virtual-keyboard";
export default function Example() {
const [value, setValue] = useState("");
return (
<VirtualInputProvider locale="en" keyboardVisibility="always">
<VirtualInput
value={value}
onValueChange={setValue}
aria-label="Your message"
maxLength={48}
/>
</VirtualInputProvider>
);
}