# @easepick/kbd-plugin

npm version (opens new window)

TIP

This package does not need to be installed if you are using @easepick/bundle.

Adds keyboard navigation.

# Quick example

<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <title>easepick</title>
    <script src="https://cdn.jsdelivr.net/npm/@easepick/datetime@[version.number]/dist/index.umd.min.js"></script>
    <script src="https://cdn.jsdelivr.net/npm/@easepick/core@[version.number]/dist/index.umd.min.js"></script>
    <script src="https://cdn.jsdelivr.net/npm/@easepick/base-plugin@[version.number]/dist/index.umd.min.js"></script>
    <script src="https://cdn.jsdelivr.net/npm/@easepick/kbd-plugin@[version.number]/dist/index.umd.min.js"></script>
  </head>
  <body>
    <input id="datepicker"/>
    <script>
      const picker = new easepick.create({
        element: document.getElementById('datepicker'),
        css: [
          'https://cdn.jsdelivr.net/npm/@easepick/core@[version.number]/dist/index.css',
        ],
        plugins: ['KbdPlugin'],
        KbdPlugin: {
          dayIndex: 2,
        },
      });
    </script>
  </body>
</html>

# Installation

# NPM

npm install @easepick/core @easepick/kbd-plugin

# CDN

<script src="https://cdn.jsdelivr.net/npm/@easepick/datetime@[version.number]/dist/index.umd.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/@easepick/core@[version.number]/dist/index.umd.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/@easepick/base-plugin@[version.number]/dist/index.umd.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/@easepick/kbd-plugin@[version.number]/dist/index.umd.min.js"></script>

# Usage

If you’re using a bundler, e.g. webpack (opens new window):

import { easepick } from '@easepick/core';
import { KbdPlugin } from '@easepick/kbd-plugin';

const picker = new easepick.create({
  element: document.getElementById('datepicker'),
  css: [
    'https://cdn.jsdelivr.net/npm/@easepick/core@[version.number]/dist/index.css',
  ],
  plugins: [KbdPlugin],
});

Another way to initialize easypick:

const picker = new easepick.create({
  element: document.getElementById('datepicker'),
  css: [
    'https://cdn.jsdelivr.net/npm/@easepick/core@[version.number]/dist/index.css',
  ],
  plugins: ['KbdPlugin'],
});

# Options

Name Type Default Description
unitIndex number 1 tabIndex for elements except days elements.
dayIndex number 2 tabIndex for days elements.