Composables
useForwardExpose
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
| Property | Type | Description |
|---|---|---|
forwardRef | (ref: ElementHandle | T | null) => void | Attach to the inner element/component's ref. |
currentRef | Ref<ElementHandle | T | null> | The raw ref value, component instance or element. |
currentElement | ComputedRef<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.