Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

vue-mytouch-keyboard

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

vue-mytouch-keyboard

Virtual keyboard component for Vue.js

  • 1.3.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
2
increased by100%
Maintainers
1
Weekly downloads
 
Created
Source

vue-touch-keyboard NPM version VueJS v2.x compatible

Virtual keyboard component for Vue.js v2.x. Designed to Raspberry Pi Touch Display

Codacy Badge Build Status Coverage Status NPMS.io score

Dependency Status devDependency Status Downloads

If you like my work, please donate. Thank you!

Demo

JSFiddle demo Codepen demo

Screenshot

Features

  • 3 built-in layouts, but you can create custom layouts
  • no external dependencies
  • full responsive
  • customizable styles
  • ...etc

Installation

NPM

You can install it via NPM.

$ npm install vue-touch-keyboard

Manual

Download zip package and unpack and add the vue-touch-keyboard.css and vue-touch-keyboard.js file to your project from dist folder.

https://github.com/icebob/vue-touch-keyboard/archive/master.zip

Usage

<template>
  <div>
    <input type="text" placeholder="Text input" @focus="show" data-layout="normal" />
    <vue-touch-keyboard :options="options" v-if="visible" :layout="layout" :cancel="hide" :accept="accept" :input="input" />
  </div>
</template>

<script>
  import VueTouchKeyboard from "vue-touch-keyboard";
  import style from "vue-touch-keyboard/dist/vue-touch-keyboard.css"; // load default style

  Vue.use(VueTouchKeyboard);

  export default {
    data: {
      visible: false,
      layout: "normal",
      input: null,
      options: {
        useKbEvents: false,
        preventClickEvent: false
      }
    },

    methods: {
        accept(text) {
          alert("Input text: " + text);
          this.hide();
        },

        show(e) {
          this.input = e.target;
          this.layout = e.target.dataset.layout;

          if (!this.visible)
            this.visible = true
        },

        hide() {
          this.visible = false;
        }
    }
  }
</script>

Properties

PropertyDefaultAccepted valuesDescription
inputrequiredHTMLInputElementThe target input HTML element
layoutrequiredString or ObjectLayout of keys. If you are using the built-in layouts, you can set as the name of the layout. If you want to use custom layout, you need to set a layout Object.
acceptnullFunctionEvent handler. Fired when the "Accept/Close" button pressed.
cancelnullFunctionEvent handler. Fired when the "Cancel" button pressed.
changenullFunctionEvent handler. Fired when the input value changed.
nextnullFunctionEvent handler. Fired when the "Next" button pressed or the length of the value of the input reached the maxLength of the input
options{}ObjectFunctional options.
defaultKeySetdefaultStringDefault key set. You can choose a desired key set of your layout to be used when a keyboard is initialized.

Options

OptionDefaultAccepted valuesDescription
useKbEventsfalsebooleanIf true, the component will generate a keydown event and trigger it. If it returns with false, it won't insert the new character.
preventClickEventfalsebooleanIf true, the component will preventDefault the click event.

Built-in layouts

  • normal - Normal full layout. Similar as real keyboard layouts
  • numeric - Only for numbers
  • compact - Compact layout. Similar as mobile phone keyboard layouts

Development

This command will start a webpack-dev-server with content of dev folder.

npm run dev

Build

This command will build a distributable version in the dist directory.

npm run build

Test

npm test

Contribution

Please send pull requests improving the usage and fixing bugs, improving documentation and providing better examples, or providing some testing, because these things are important.

License

vue-touch-keyboard is available under the MIT license.

Contact

Copyright (C) 2016 Icebob

@icebob @icebob

Keywords

FAQs

Package last updated on 23 Jul 2019

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc