type-alias / @typed/ui

Dom.ElementRefCallback

Callback invoked with the exact mounted DOM element.

Learn this UI primitive →

Package version
1.0.0-beta.13
Category
Element ref types
Since
1.0.0
Member of
Dom

Import

import { Dom } from "@typed/ui";

Access Dom.ElementRefCallback through the imported Dom export. Its declaration below describes the member.

This public exposure is a re-export. Its import path is supported; declaration documentation is shared with the other public exposures below.

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