svelte-attach-key

Hotkey attachments for Svelte 5 elements

Simple key

Press L anywhere to like

hotkey("l")

Modifier keys

Press Ctrl+S to save

hotkey("ctrl+s")

Cross-platform mod

Press Mod+Z (Ctrl on Windows/Linux, ⌘ on Mac)

hotkey("mod+z")

Direct option

Shortcut passed in the attachment options instead of markup

hotkey("shift+space")

Conditional

Press K — toggle to enable/disable

{@attach enabled && hotkey("k")}

Alternatives

Either J or will trigger the button

hotkey(["j", "arrowdown"])