svelte-hotkeys
TypeScript icon, indicating that this package has built-in type declarations

0.1.1 • Public • Published

Docs coming soon!

Meanwhile, basic usage:

import { hotkeys } from "svelte-hotkeys";

Later in svelte component

<svelte:window use:hotkeys={{ keys: 'ctrl+x', handler: (ev) => console.log(ev) }} />

This binds hotkeys to the window, as in hitting the key anywhere will trigger the handler

if you wanna make hotkeys specific to a specific element, as in, if a div is in focus and user hits the key combo, the handler should be triggered. This can be done by applying this action on a focusable div

<div tabindex={0} use:hotkeys={{ keys: 'ctrl+x', handler: (ev) => console.log(ev) }} />

Dependencies (0)

    Dev Dependencies (3)

    Package Sidebar

    Install

    npm i svelte-hotkeys

    Weekly Downloads

    9

    Version

    0.1.1

    License

    MIT

    Unpacked Size

    3.24 kB

    Total Files

    5

    Last publish

    Collaborators

    • puruvj