
Security News
npm Adopts OIDC for Trusted Publishing in CI/CD Workflows
npm now supports Trusted Publishing with OIDC, enabling secure package publishing directly from CI/CD workflows without relying on long-lived tokens.
ngx-touch-virtual-keyboard
Advanced tools
Simple virtual keyboard that inteact with common input elements. Supports multipl input type with different layout automatically applied.
# NgxTouchVirtualKeyboard
Simple angular virtual keyboard component.
Library | Angular compatibility | Type |
---|---|---|
^16.x.x | ^16.0.0, ^17.0.0 | 🟢 LTS |
^15.x.x | ^15.0.0 | 🔴 EOL |
Version 15 is not planned to get
Simple virtual keyboard that inteact with common input elements. Supports multiple input type with different layout automatically applied.
Possibile to customize:
Main features:
Install package (console) and import module (in app.module.ts)
npm i ngx-touch-virtual-keyboard
@NgModule({
imports: [
...
NgxTouchVirtualKeyboardModule
],
..
})
⚠️ Continue adding default icons and theme
To load correctly default icons add in angular.json assets import.
Do not change the output path must be defined like that in order to use default assets from lib.
"assets": [
{
"glob": "**/*",
"input": "./node_modules/ngx-touch-virtual-keyboard/assets/",
"output": "/assets/ngx-tvk/"
}
],
To include theme you can
"styles": [
...,
"./node_modules/ngx-touch-virtual-keyboard/theme/ngx-touch-virtual-keyboard-theme.scss"]
],
@import './node_modules/ngx-touch-virtual-keyboard/theme/ngx-touch-virtual-keyboard-theme';
... override style here ...
Inside appComponent. Add component
<router-outlet></router-outlet>
<ngx-touch-virtual-keyboard></ngx-touch-virtual-keyboard>
Use directive "useVirtualKeyboard" in input component to connect input element with keyboard
<input type="text" useVirtualKeyboard placeholder="Type here..." />
Build in component there are just 2 simple layout ['us' and 'it']. 'US' is the deafult. A layout can be dynamically selected with @Input layout parameter.
Current language is displayed inside the space button. If input parameter is not exisitng a console error is raised and the default layout is used.
<ngx-touch-virtual-keyboard layout="it"></ngx-touch-virtual-keyboard>
<ngx-touch-virtual-keyboard [layout]="currentLayout"></ngx-touch-virtual-keyboard>
Define in app.module or at compoent level a new array for layouts and provide this as new layout for keyboard compoent. This will override all default layout, but you can redefine them.
Array type is : { layout: string; values: (INGXKeyElement | string)[][] }[].
import { KEYBOARD_LAYOUT_DEFAULT } from 'ngx-touch-virtual-keyboard';
import { INGXKeyElement, k } from 'ngx-touch-virtual-keyboard';
const defaultKeyboard: { layout: string; values: (INGXKeyElement | string)[][] }[] = [
{
layout: 'myCustom',
values: [
[
k('\\', '|'), k('1', '!'), k('2', '"'), k('3', '£'), k('4', '$'), k('5', '%'), k('6', '&'),
k('7', '/'), k('8', '('), k('9', ')'), k('0', '='), k("'", '?'),'backspace',
],
['tab', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'a'],
['a', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'a'],
['shift', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'a', k(',', ';'), k('.', ':'), k('-', '_'), 'shift'],
['space', 'left', 'right'],
],
},
{
layout: 'gb',
values: [ .... ],
}
];
providers: [
{ provide: KEYBOARD_LAYOUT_DEFAULT, useValue: defaultKeyboard },
],
Restricted string representing scpecial buttons are:
Example from previous code (myDefault alyout is applied as default):
All icons can be changed with custom svg. Providing in app.module.ts a new svg reference for each icon to change.
ICON_BACKSPACE | ICON_ERASE | ICON_EYE_SLASH | ICON_EYE | ICON_KEYBOARD | ICON_LEFT | ICON_RIGHT | ICON_SHIFT
import {ICON_BACKSPACE, ICON_KEYBOARD} from 'ngx-touch-virtual-keyboard';
...
providers: [
{provide: ICON_BACKSPACE, useValue: 'assets/icons/bugs.svg'},
{provide: ICON_KEYBOARD, useValue: 'assets/icons/bugs.svg'},
],
List of all icons tahtn can be replaced
Example from previous provided custom bugs.svg
Each input type have a specific keyboard layout opened, for example:
<input type="text"/>
this will use default keyboard<input type="number"/>
this will use default numberThis is the current supported type. If not changed each time an input with this type is selected specific layout keyboard is opend
const mapInputLayout: { inputType: MapInputType; keyboardType: MapKeyboardType }[] = [
{ inputType: 'text', keyboardType: 'default' },
{ inputType: 'url', keyboardType: 'default' },
{ inputType: 'email', keyboardType: 'email' },
{ inputType: 'password', keyboardType: 'password' },
{ inputType: 'number', keyboardType: 'number' },
{ inputType: 'range', keyboardType: 'number' },
{ inputType: 'tel', keyboardType: 'tel' },
];
On input element after marked it with directive "useVirtualKeyboard", jsut force the layoutType with setKeyboardType="..."
This example will "email" keyboard also if type is text.
<input type="text" useVirtualKeyboard setKeyboardType="email" placeholder="Type email here..." />
It is possible to override the KEYBOARD_MAP_INPUT_TO_LAYOUT with a custom mapping. This will open automatically for all input type the numeric layout keyboard
providers: [
{
provide: KEYBOARD_MAP_INPUT_TO_LAYOUT,
useValue: [
{ inputType: 'text', keyboardType: 'number' },
{ inputType: 'url', keyboardType: 'number' },
{ inputType: 'email', keyboardType: 'number' },
{ inputType: 'password', keyboardType: 'number' },
{ inputType: 'number', keyboardType: 'number' },
{ inputType: 'range', keyboardType: 'number' },
{ inputType: 'tel', keyboardType: 'number' },
],
},
],
Theme can be customized. All useful parameter are defined in projects/ngx-touch-virtual-keyboard/theme/ngx-touch-virtual-keyboard-theme.scss
Below just an example how to locally override variables. Always reference to this file for complete list. If some variable is missing just opene a change request
@import './node_modules/ngx-touch-virtual-keyboard/theme/ngx-touch-virtual-keyboard-theme';
//keys
:host {
--ngx-tvk-key-background-color: darkgray;
--ngx-tvk-key-background-color-hover: orange;
--ngx-tvk-key-border-color-pressed: white;
}
...
New release version for angular16 and further compatibility
Released all functionality for angular15 compatibility
-KEYBOARD_LAYOUT renamed in KEYBOARD_LAYOUT_DEFAULT
FAQs
Simple virtual keyboard that inteact with common input elements. Supports multipl input type with different layout automatically applied.
The npm package ngx-touch-virtual-keyboard receives a total of 0 weekly downloads. As such, ngx-touch-virtual-keyboard popularity was classified as not popular.
We found that ngx-touch-virtual-keyboard demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
npm now supports Trusted Publishing with OIDC, enabling secure package publishing directly from CI/CD workflows without relying on long-lived tokens.
Research
/Security News
A RubyGems malware campaign used 60 malicious packages posing as automation tools to steal credentials from social media and marketing tool users.
Security News
The CNA Scorecard ranks CVE issuers by data completeness, revealing major gaps in patch info and software identifiers across thousands of vulnerabilities.