KeyMatcher
typeSource L7Type contract for KeyMatcher.
type KeyMatcher = string | string[] | ((event: KeyboardEvent) => boolean)Open-code aq-ui React hook for Use Key Press.
pnpm dlx aq-ui@alpha add use-key-pressImport the parts you need, then jump to an export for its contract.
"use client"
import { useKeyPress } from "@/hooks/use-key-press"Type contract for KeyMatcher.
type KeyMatcher = string | string[] | ((event: KeyboardEvent) => boolean)Open-code aq-ui React hook for Use Key Press.
function useKeyPress(matcher: KeyMatcher, target?: Target<EventTarget>, { enabled = true, preventDefault = false }: UseKeyPressOptions = {}): booleanboolean| Name | Type | Default |
|---|---|---|
matcher | KeyMatcher | — |
target? | Target<EventTarget> | — |
options? | UseKeyPressOptions | {} |
Type contract for UseKeyPressOptions.
interface UseKeyPressOptions| Name | Type | Default |
|---|---|---|
enabled? | boolean | true |
preventDefault? | boolean | false |
hook-target