createHeldKeys
function createHeldKeys(): () => string[];Defined in: createHeldKeys.ts:26
SolidJS primitive that returns a signal of currently held keyboard keys.
This primitive uses useSelector from @tanstack/solid-store to subscribe
to the global KeyStateTracker and updates whenever keys are pressed
or released.
Returns
Signal accessor for array of currently held key names
() => string[]
Example
function KeyDisplay() {
const heldKeys = createHeldKeys()
return (
<div>
Currently pressed: {heldKeys().join(' + ') || 'None'}
</div>
)
}