Composables

useForwardExpose

Source
Forward a wrapper component's exposed methods, refs, and props through to its inner child, asChild-style.
Advanced. Primitive-authoring utility from @vyui/core — most app code never calls this directly.

Overview

import { useForwardExpose } from '@vyui/core'

const { forwardRef, currentRef, currentElement } = useForwardExpose()

Lets a wrapper component transparently forward expose()d methods/refs and props from an inner child up through itself, and returns a forwardRef function to attach to the inner element or component's ref.

Returns

PropertyTypeDescription
forwardRef(ref: ElementHandle | T | null) => voidAttach to the inner element/component's ref.
currentRefRef<ElementHandle | T | null>The raw ref value, component instance or element.
currentElementComputedRef<ElementHandle>The resolved underlying element, unwrapped from a component instance if needed.

When to use it

Used for asChild-style APIs — see @vyui/core for the Primitive / Slot / asChild pattern this supports.