Theme
Hotkey
Keyboard shortcut handler with modifier support
Start Here
Start from the smallest working snippet, then move to interactive examples and the full API contract below.
Styled quick start
Copy this entrypoint first. It includes the imports required to get the component on screen.
Import options
Root package
ts
import { Hotkey } from '@dryui/ui'Per-component subpath
ts
import { Hotkey } from '@dryui/ui/hotkey'Customize
Use the interactive examples to see common variants, states, and composition patterns before building your own.
Keyboard Shortcut Handler
Press Cmd+S / Ctrl+S to save
Press Cmd+K / Ctrl+K to open palette
Save count: 0
svelte
<script lang="ts">
import { Hotkey } from '@dryui/ui';
let saveCount = $state(0);
</script>
<Hotkey keys="cmd+s" handler={() => saveCount++} preventDefault />
<Hotkey keys="cmd+k" handler={() => alert('open command palette')} preventDefault />
<p>Press Cmd+S to save. Saved {saveCount} times.</p>Compose
The full API contract lives here: props, CSS variables, and the public data attributes you can target when styling.
| Prop | Type | Default | Required | Bindable |
|---|
Also accepts standard HTML attributes (class, style, id, etc.)