Skip to content

About

React virtual keyboard (on-screen keyboard) with Korean two-set (dubeolsik) Hangul composition as you type (via es-hangul), plus English, number and phone keypads, custom layouts with macro keys, and input filters that also apply to paste.

Topics

Resources

Contributing

Stars

1 star

Watchers

0 watching

Forks

Latest commit

 

History

200 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Virtual Keyboard logo

React Virtual Keyboard

React virtual keyboard (on-screen keyboard) with Korean Hangul composition, plus English, number and phone keypads

npm version license CI react peer dependency types uses es-hangul

Demo · npm · Changelog · 한국어

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.

How it differs

  • 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, sanitizeValue and maxLength apply 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.

What works now

  • VirtualInputProvider and VirtualInput, plus the types InputMode, 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, sanitizeValue and maxLength for 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 done / planned

  • Not tested with VoiceOver or TalkBack. Only automated axe checks pass
  • No type="password", autofill or form submission through name
  • 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
  • number mode 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 keyboardVisibility explicitly for fixed behavior
  • No framework-agnostic core for non-React frameworks

Installation

npm install @uiwwsw/virtual-keyboard

Requires React and React DOM 18 or 19.

Usage

"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>
  );
}

Docs

License

MIT

About

React virtual keyboard (on-screen keyboard) with Korean two-set (dubeolsik) Hangul composition as you type (via es-hangul), plus English, number and phone keypads, custom layouts with macro keys, and input filters that also apply to paste.

Topics

Resources

Contributing

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages