ShortcutProvider
Owner-scoped chord and sequence dispatcher with usePendingShortcut feedback.@gemologic/sheen · applicationPlayground
This example has no scalar controls. Its validated source remains interactive below.
Workspace
<ShortcutProvider development={true}><p>Workspace</p></ShortcutProvider>Variant matrix
Keyboard owner
Workspace
Anatomy
- Package
@gemologic/sheen- Source
packages/ui/src/primitives/ShortcutProvider.tsx- Tokens
- None
Accessibility
Role: noneKeyboard: Registered chordsDo
- Use useShortcut inside an owned child component.
- Keep platform and development configuration stable for the provider lifetime.
Do not
- Do not infer backend or modal state from this provider.
- Do not register reserved browser shortcuts or assume disposal cancels application transport.
Generated props
| Name | Type | Default | Description |
|---|---|---|---|
children | JSX.Element | — | Owned application content; one provider per document, no nested providers. |
platform | "mac" | "other" | — | Optional mac/other override, read at construction. When omitted, resolve navigator.platform on mount before registering bindings. SSR and initial hydration expose an empty inventory, never provisional wrong-platform bindings. |
development * | boolean | — | Required collision policy, read at construction: development throws, production warns and uses last registration. |
activeScopes | readonly string[] | — | Reactive outer-to-inner base scope IDs; default global. Focused ShortcutScope boundaries append outer-to-inner scopes. Open sheen dialogs override both with the newest active modal scope. Changes cancel pending sequences; non-sheen overlays must still manage their own isolation. |
characterShortcuts | boolean | — | Allow character-only single keys and sequences, default true. Wire to a user-facing preference. False retains bindings requiring Ctrl, Meta, Alt, or a non-character key. Changes cancel pending input; the app owns persistence. |
onError | (error: unknown) => void | — | Reports synchronous failures and async rejections while their registration is alive. Matched defaults are prevented before execution. Disposed registrations consume late rejections without notifying a new owner. Without a handler, live errors are rethrown in a microtask. |