Skip to content
aq-ui
Back to HooksHook

Use Escape Key

Open-code aq-ui React hook for Use Escape Key.

Installation

pnpm dlx aq-ui@alpha add use-escape-key

API reference

Client module

Import the parts you need, then jump to an export for its contract.

View full source

Quick start

"use client"

import { useEscapeKey } from "@/hooks/use-escape-key"

useEscapeKey

functionSource L16

Open-code aq-ui React hook for Use Escape Key.

function useEscapeKey(callback: (event: KeyboardEvent) => void, { enabled = true, capture = true, preventDefault = false, stopPropagation = false, target, }: UseEscapeKeyOptions = {}): void
Returns
void

Parameters

NameTypeDefault
callback(event: KeyboardEvent) => void—
options?UseEscapeKeyOptions{}

UseEscapeKeyOptions

interfaceSource L8

Type contract for UseEscapeKeyOptions.

interface UseEscapeKeyOptions

Members

NameTypeDefault
enabled?booleantrue
capture?booleantrue
preventDefault?booleanfalse
stopPropagation?booleanfalse
target?Target<EventTarget>—

Registry dependencies

hook-target, use-stable-callback

Files

  • hooks/use-escape-key.ts

Source