Skip to main content
.overlay(content: Component): Component;
.overlay(props: { alignment: Alignment }, content: Component): Component;

Parameters

content
Component
The component to display as an overlay on top of this view.
props
{ alignment: Alignment }
Configuration object for the overlay positioning.

Support

Usage

Basic overlay (centered)

Rectangle()
    .fill(Color("blue"))
    .frame(200, 150)
    .overlay(Text("Centered text"))

Overlay with specific alignment

Rectangle()
    .fill(Color("gray"))
    .frame(300, 200)
    .overlay(
        { alignment: "topLeading" },
        Text("Top-left")
    )