# lifecycle-aware-component

A component base that exposes [`initializing`](https://www.hyperfrontend.dev/docs/libraries/state-machine/lifecycle-aware-component/#api-LifecycleAwareComponent), [`ready`](https://www.hyperfrontend.dev/docs/libraries/state-machine/lifecycle-aware-component/#api-LifecycleAwareComponent), [`starting`](https://www.hyperfrontend.dev/docs/libraries/state-machine/lifecycle-aware-component/#api-LifecycleAwareComponent), [`stopping`](https://www.hyperfrontend.dev/docs/libraries/state-machine/lifecycle-aware-component/#api-LifecycleAwareComponent), and [`active`](https://www.hyperfrontend.dev/docs/libraries/state-machine/lifecycle-aware-component/#api-LifecycleAwareComponent) state phases plus per-phase change callbacks.

[`LifecycleAwareComponent`](https://www.hyperfrontend.dev/docs/libraries/state-machine/lifecycle-aware-component/#api-LifecycleAwareComponent) models a stateful component whose visibility to consumers depends on which phase it has reached: for example, a UI element that should only render after [`ready`](https://www.hyperfrontend.dev/docs/libraries/state-machine/lifecycle-aware-component/#api-LifecycleAwareComponent) or a service that needs to drain in-flight work on [`stopping`](https://www.hyperfrontend.dev/docs/libraries/state-machine/lifecycle-aware-component/#api-LifecycleAwareComponent) before becoming inactive. Each phase exposes a typed change callback ([`InitializingChangeCallback`](https://www.hyperfrontend.dev/docs/libraries/state-machine/lifecycle-aware-component/#api-InitializingChangeCallback), [`ReadyChangeCallback`](https://www.hyperfrontend.dev/docs/libraries/state-machine/lifecycle-aware-component/#api-ReadyChangeCallback), [`StartingChangeCallback`](https://www.hyperfrontend.dev/docs/libraries/state-machine/lifecycle-aware-component/#api-StartingChangeCallback), [`StoppingChangeCallback`](https://www.hyperfrontend.dev/docs/libraries/state-machine/lifecycle-aware-component/#api-StoppingChangeCallback), [`ActiveChangeCallback`](https://www.hyperfrontend.dev/docs/libraries/state-machine/lifecycle-aware-component/#api-ActiveChangeCallback)) so subclasses or wrappers can react when the component crosses a boundary. The component composes the lower-level [`Events`](https://www.hyperfrontend.dev/docs/libraries/state-machine/events/#api-Events) registry under the hood; reach for it when you need a structured lifecycle rather than raw pub/sub.

---

Canonical page: https://www.hyperfrontend.dev/docs/libraries/state-machine/lifecycle-aware-component/
This file: https://www.hyperfrontend.dev/docs/libraries/state-machine/lifecycle-aware-component.md
Documentation index: https://www.hyperfrontend.dev/llms.txt
