|
1 | | -# hi-vkbd |
2 | | -A lightweight Hindi virtual keyboard UI for web applications. |
| 1 | +vkbd |
| 2 | +====== |
| 3 | + |
| 4 | +A lightweight Hindi/English virtual keyboard UI for web applications. |
| 5 | + |
| 6 | +[](https://www.npmjs.com/package/vkbd) |
| 7 | + |
| 8 | +[](https://www.npmjs.com/package/vkbd) |
| 9 | +[](https://www.jsdelivr.com/package/npm/vkbd) |
| 10 | +[](https://github.com/indianmodassir) |
| 11 | +[](https://github.com/jsvibe/vkbd/actions/workflows/npm-publish.yml) |
| 12 | + |
| 13 | + |
| 14 | +## ✨ Features |
| 15 | +- 🖊️ Hindi + English typing support |
| 16 | +- 🎨 Light / Dark / System theme support with variants |
| 17 | +- 🖥️ On-screen draggable keyboard (movable dialog) |
| 18 | +- 🔀 Language switch (EN ⇄ HI) |
| 19 | +- ⌨️ Special keys (Shift, Caps, Alt, Backspace, Enter, etc.) |
| 20 | +- 📦 Zero dependency, pure JavaScript |
| 21 | + |
| 22 | +Installation |
| 23 | +------------ |
| 24 | + |
| 25 | +```bash |
| 26 | +npm install vkbd |
| 27 | +``` |
| 28 | + |
| 29 | +or via yarn: |
| 30 | + |
| 31 | +```bash |
| 32 | +yarn add vkbd |
| 33 | +``` |
| 34 | + |
| 35 | +Including vkbd |
| 36 | +-------------- |
| 37 | + |
| 38 | +Below are some of the most common ways to include vkbd. |
| 39 | + |
| 40 | +### Browser |
| 41 | + |
| 42 | +**CDN Link** |
| 43 | + |
| 44 | +```html |
| 45 | +<script src="https://cdn.jsdelivr.net/npm/printfy@1.0.0/lib/vkbd.min.js"></script> |
| 46 | +``` |
| 47 | + |
| 48 | +You can add the script manually to your project: |
| 49 | + |
| 50 | +```html |
| 51 | +<script src="vkbd.js"></script> |
| 52 | +``` |
| 53 | + |
| 54 | +Webpack / Browserify / Babel |
| 55 | +---------------------------- |
| 56 | + |
| 57 | +There are several ways to use [Webpack](https://webpack.js.org/), [Browserify](http://browserify.org/) or [Babel](https://babeljs.io/). For more information on using these tools, please refer to the corresponding project's documentation. In the script, including printfy will usually look like this: |
| 58 | + |
| 59 | +```js |
| 60 | +import vkbd from 'vkbd'; |
| 61 | +``` |
| 62 | + |
| 63 | +API Usage |
| 64 | +--------- |
| 65 | + |
| 66 | +### Usage in React |
| 67 | + |
| 68 | +```js |
| 69 | +import 'vkbd.css'; |
| 70 | +import vkbd from 'vkbd'; |
| 71 | + |
| 72 | +function App() { |
| 73 | + |
| 74 | + const kbdUI = new vkbd({ |
| 75 | + lang: 'hi', // 'hi' or 'en' |
| 76 | + theme: 'dark', // e.g, 'light', 'dark', 'system' |
| 77 | + themeVariant: 1, // 1-3 |
| 78 | + }); |
| 79 | + |
| 80 | + // OR |
| 81 | + // const kbdUI = new vkbd(); |
| 82 | + // kbdUI.open(inputElement|selector); |
| 83 | + // kbdUI.close(); |
| 84 | + |
| 85 | + return ( |
| 86 | + <div> |
| 87 | + <div> |
| 88 | + <input type="text" placeholder="Firstname" id="firstname" /> |
| 89 | + <span onClick={() => kbdUI.open("#firstname")}>⌨️</span> |
| 90 | + </div> |
| 91 | + <div> |
| 92 | + <input type="text" placeholder="Surname" id="surname" /> |
| 93 | + <span onClick={kbdUI.open("#surname")}>⌨️</span> |
| 94 | + </div> |
| 95 | + </div> |
| 96 | + ); |
| 97 | +} |
| 98 | + |
| 99 | +export default App; |
| 100 | +``` |
| 101 | + |
| 102 | + |
| 103 | + |
| 104 | +### Usage in Browser |
| 105 | + |
| 106 | +```html |
| 107 | +<!DOCTYPE html> |
| 108 | +<html lang="en"> |
| 109 | +<head> |
| 110 | + <meta charset="UTF-8"> |
| 111 | + <meta name="viewport" content="width=device-width, initial-scale=1.0"> |
| 112 | + <title>Virtual Keyboard UI</title> |
| 113 | + <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/printfy@1.0.0/lib/vkbd.min.css"> |
| 114 | + <script src="https://cdn.jsdelivr.net/npm/printfy@1.0.0/lib/vkbd.min.js"></script> |
| 115 | + |
| 116 | + <!-- Keboard UI Configuration --> |
| 117 | + <script> |
| 118 | + const kbdUI = new vkbd({ |
| 119 | + lang: 'hi', // 'hi' or 'en' |
| 120 | + theme: 'light', // e.g, 'light', 'dark', 'system' |
| 121 | + themeVariant: 1, // 1-3 |
| 122 | + }); |
| 123 | +
|
| 124 | + // OR |
| 125 | + // const kbdUI = new vkbd(); |
| 126 | + // kbdUI.open(inputElement|selector); |
| 127 | + // kbdUI.close(); |
| 128 | + </script> |
| 129 | +</head> |
| 130 | +<body> |
| 131 | + <div> |
| 132 | + <div> |
| 133 | + <input type="text" placeholder="Firstname" id="firatname" /> |
| 134 | + <span onclick="kbdUI.open('#firatname')">⌨️</span> |
| 135 | + </div> |
| 136 | + <div> |
| 137 | + <input type="text" placeholder="Surname" id="surname" /> |
| 138 | + <span onclick="kbdUI.open('#surname')">⌨️</span> |
| 139 | + </div> |
| 140 | + </div> |
| 141 | +</body> |
| 142 | +</html> |
| 143 | +``` |
| 144 | + |
| 145 | + |
| 146 | + |
| 147 | +Configuration Options |
| 148 | +--------------------- |
| 149 | + |
| 150 | +That means the user can set these options (such as `lang`, `theme`, `themeVariant`) to control the keyboard’s language, theme, and style. |
| 151 | + |
| 152 | +|Option|Type|Default|Description| |
| 153 | +|:-----|:---|:------|:----------| |
| 154 | +|lang|string|'hi'|Initial language (`hi` or `en`)| |
| 155 | +|theme|string|'light'|Theme: `light`, `dark`, `system` |
| 156 | +|themeVariant|number|1|Theme style variant (1–3) |
| 157 | + |
| 158 | +📚 API |
| 159 | +------ |
| 160 | + |
| 161 | +- `vkbd(options)` returns a keyboard instance |
| 162 | +- `keyboard.open(elem)` open keyboard for given input/textarea |
| 163 | +- `keyboard.close()` close keyboard |
| 164 | + |
| 165 | +Contributing |
| 166 | +------------ |
| 167 | + |
| 168 | +Pull requests are welcome! For major changes, please open an issue first to discuss what you would like to change. |
| 169 | + |
| 170 | +License |
| 171 | +------- |
| 172 | + |
| 173 | +Licensed Under [MIT](LICENSE) |
| 174 | + |
| 175 | +Copyright (c) 2025 [Indian Modassir](https://github.com/indianmodassir) |
0 commit comments