Overlay

Dark semi-transparent layer to direct user attention to its content.
Import
import { Overlay } from "@uicapsule/components";
import type { OverlayProps } from "@uicapsule/components";
Related components
Works with any content
Automatically stretches based on the background content


Usage

By default, Overlay covers the whole background area and centers its content.

<Overlay
backgroundSlot={
<AspectRatio ratio={16 / 9}>
<Image src="/img/examples/image-retina.webp" width="100%" />
</AspectRatio>
}
>
Overlay content
</Overlay>

Position

With the position property, you can control the side at which you want to render the content.

<Overlay
position="bottom"
backgroundSlot={
<AspectRatio ratio={16 / 9}>
<Image src="/img/examples/image-retina.webp" width="100%" />
</AspectRatio>
}
>
<Text variant="title-3">Image title</Text>
</Overlay>

Slots

When used without backgroundSlot, Overlay will become absolute positioned and take the entire width and height of the parent element.

<View
height="300px"
backgroundColor="positive"
borderRadius="large"
overflow="hidden"
attributes={{ style: { position: "relative" } }}
>
<Overlay>Overlay content</Overlay>
</View>
Previous