# useEventListener

```ts
import { useEventListener, Group, type PibblNode } from "@pibbl/core";
```

`useEventListener(handlers)` accepts [`PibblEventHandlers`](/reference/types/events/#pibbleventhandlers), is render-only, and updates propagation listeners
for the current component identity. It does not define hit geometry; combine it
with a primitive target or `useEventTarget`. Pibbl owns the listener registration
and releases it on replacement or component teardown.

```tsx
function Panel({ children }: { children: PibblNode }) {
  useEventListener({ onClickCapture: (event) => console.log(event.type) });
  return <Group>{children}</Group>;
}
```

See the [Propagation and cancellation live example](/playground/#/examples/events-and-interaction/propagation-and-cancellation).

Container children use [`PibblNode`](/reference/types/elements-components/#pibblnode).

## API details from source

<span id="api-useEventListener"></span>

Registers the current component's event handlers with mount-owned cleanup.

```ts
useEventListener: (handlers: PibblEventHandlers) => void
```

Related API: [useEventListener](/reference/hooks/use-event-listener/), [PibblEventHandlers](/reference/types/events/#pibbleventhandlers).

### Parameters

- **`handlers`** — Handlers to register for the current component's event participation. See
[PibblEventHandlers](/reference/types/events/#pibbleventhandlers) .

### See also

[PibblEventHandlers](/reference/types/events/#pibbleventhandlers)

[View source — packages/core/src/lib/hooks/use-event-listener.ts:19](/source/packages/core/src/lib/hooks/use-event-listener-ts/#L19)

## Implementation guidance for agents

Read the [Input, focus, and native HTML companion](/agents/topics/input/) for ownership, adaptation, failure modes, and verification. [Agent start](/agents/) provides the version-selection workflow.

## Complete minimal examples

- [Typed event target](/minimal-examples/events/target/): A geometric Canvas target routes pointer, mouse, touch, wheel, keyboard, input, clipboard, and drag events. [Plain source](/minimal/events/target.tsx)
## Documentation version

Documentation built with @pibbl/core 0.0.2, revision 272a94a. ALPHA — NOT FOR PRODUCTION USE.
