Vize

parent-element

Track the parent element of a reactive element target.

Package @vizejs/composable/parent-element
Own the source vize lib pull composable:parent-element
Runtime exports useParentElement
Gzip budget 1792 B

Usage

import { useParentElement } from "@vizejs/composable/parent-element";

Runtime contract

Utility Category Stability SSR Hydration Cleanup Targets Host globals Uses
useParentElement dom experimental deterministic-fallback stable reactive-scope web, desktop — isElementNode, resolveElement, tryOnScopeDispose

API

useParentElement

Track the parent element of a reactive element target. Re-reads parentElement whenever the target resolves or changes (after the DOM update). Server renders expose null.

function useParentElement(target: MaybeElementTarget): Readonly<ShallowRef<Element | null>>