type-alias / @typed/ui/Dom/Types

ElementRefCallback

Callback invoked with the exact mounted DOM element.

Learn this UI primitive →

Package version
1.0.0-beta.7
Category
Element ref types
Since
1.0.0

Import

import type { ElementRefCallback } from "@typed/ui/Dom/Types";

Signatures

export type ElementRefCallback<Element extends globalThis.Element> = (element: Element) => void | EffectInput | Stream.Stream<any, any, any> | Stream.Stream<any, never, never> | Fx<any, any, any> | Fx<any, never, never>;

Why

A ref can initialize imperative web-standard APIs or return Effect, Stream, or Fx work without replacing the node or hiding its identity.

Ownership and lifetime

Returned Effect, Stream, or Fx work runs in the element’s rendering Scope and is interrupted when that Scope closes.

Other public imports

These import paths expose the same declaration. Each page retains its own public name and signature.

Source