atomico-hooks-events

Official

Typed event hooks for component communication

Authoratomicojs
Version1.0.0
Installs0

System Documentation

What problem does it solve?

Managing custom events and DOM listeners across web components is error-prone and verbose, leading to stale handlers, untyped payloads, and fragile cross-component communication. This Skill documents the useEvent and useListener hooks plus the event() prop helper to provide a consistent, typed approach for dispatching and listening to events within Atomico components while ensuring proper cleanup and predictable timing.

Core Features & Use Cases

  • Dispatch Typed Events: useEvent creates a cached dispatcher that sends typed CustomEvent payloads from the host element, or calls matching event props when present.
  • Ref-based Listeners with Auto-cleanup: useListener attaches handlers to referenced elements, updates to the latest handler, and removes listeners when refs change or the component unmounts.
  • Prop-based Event Integration: event() declares props that act as both internal dispatchers and external callback listeners, enabling parent callbacks and JSX on-prefixed listeners.
  • Use Cases: Build interactive UI elements that emit structured events to parents, implement pub/sub patterns across components, and attach stable handlers to internal or external DOM nodes.

Quick Start

Use useEvent to dispatch typed CustomEvents and use useListener to attach and auto-cleanup a ref-based handler inside an Atomico component.

Dependency Matrix

Required Modules

None required

Components

Standard package

💻 Claude Code Installation

Recommended: Let Claude install automatically. Simply copy and paste the text below to Claude Code.

Please help me install this Skill:
Name: atomico-hooks-events
Download link: https://github.com/atomicojs/atomico/archive/main.zip#atomico-hooks-events

Please download this .zip file, extract it, and install it in the .claude/skills/ directory.
View Source Repository

Agent Skills Search Helper

Install a tiny helper to your Agent, search and equip skill from 471,000+ vetted skills library on demand.