LavaUI docs

struct ComposedOverlayView

Swift

struct ComposedOverlayView<Content, OverlayContent> where Content : View, OverlayContent : View

A base view with content drawn over it, taking no layout space.

Distinct from overlay(isPresented:), which is a popup: that one detaches its subtree, emits it after the whole tree walk to escape clipping, takes input priority, and dismisses on an outside click. Those semantics are right for a menu and wrong for anything permanent — an always-present button presented that way makes the window behave like an open menu, swallowing clicks that land anywhere else.

This is the composition variant: a floating action button, a badge on a corner, a control that belongs on a canvas rather than beside it. It is an absolutely positioned Yoga child, which buys all four required behaviours from the layout engine rather than from special cases:

  • No layout contribution. An absolute child is not part of its parent's flex flow, so the base view measures exactly as it did without the overlay.
  • Painted above. Emission is in childNodes order and the overlay is declared second, so it lands on top of the base.
  • Ordinary hit testing. It is a real node with real geometry; the hit walk visits children in reverse, so the overlay is tested before the base and everything else behaves normally. No priority, no dismissal.
  • Anchored. Yoga edge insets do the placement, so it survives resizes without a re-layout pass of its own.

Sources/LavaUI/ComposedOverlay.swift:33

Constructors

init(content: Content, overlayContent: OverlayContent, anchor: OverlayAnchor, inset: Float, style: OverlayStyle? = nil)

Not documented.

Sources/LavaUI/ComposedOverlay.swift:49

Properties

var anchor: OverlayAnchor

Not documented.

Sources/LavaUI/ComposedOverlay.swift:36

var content: Content

Not documented.

Sources/LavaUI/ComposedOverlay.swift:34

var dumpDetail: String { get }

Not documented.

Sources/LavaUI/ComposedOverlay.swift:63

var inset: Float

Not documented.

Sources/LavaUI/ComposedOverlay.swift:37

var overlayContent: OverlayContent

Not documented.

Sources/LavaUI/ComposedOverlay.swift:35

var style: OverlayStyle?

Panel styling for the floating surface, or nil to draw no surface at all — a bare badge or button that is only its own content.

Optional here and not in OverlayView because the two have different defaults for good reason. A popup is a surface by definition: a menu with no plate under it is unreadable over whatever it covers. Composed content is usually already a styled thing of its own, and giving it a theme-coloured plate it never asked for would put a rectangle behind every floating button in the codebase.

Sources/LavaUI/ComposedOverlay.swift:47

Methods

func mountPrimitive() -> any AnyViewNode

Not documented.

Sources/LavaUI/ComposedOverlay.swift:75

func reconcilePrimitive(_ node: any AnyViewNode) -> any AnyViewNode

Not documented.

Sources/LavaUI/ComposedOverlay.swift:88

func structureLines(indent: Int = 0) -> [String]

Not documented.

Sources/LavaUI/ComposedOverlay.swift:65