function createHotkeyAttachment(
hotkey,
callback,
options): Attachment<HTMLElement>;
Defined in: packages/svelte-hotkeys/src/createHotkey.svelte.ts:108
Create an attachment for element-scoped hotkeys.
MaybeGetter<RegisterableHotkey>
HotkeyCallback
MaybeGetter<CreateHotkeyOptions> = {}
Attachment<HTMLElement>
<script lang="ts">
import { createHotkeyAttachment } from '@tanstack/svelte-hotkeys'
let count = $state(0)
const saveHotkey = createHotkeyAttachment('Mod+S', () => {
count++
})
</script>
<div tabindex="0" {@attach saveHotkey}>
Count: {count}
</div>