Skip to content
Playground

Overlay

Content layered over media on hover, focus, or persistently.

Content layered over media on hover, focus, or persistently.

Turquoise Moraine Lake surrounded by evergreen forest and mountains

Moraine Lake

Banff at sunrise

The examples use photographs from Unsplash by ConfinedRiley, Tim G, and Sebastian Schuster.

Overlay keeps the base surface and its layered content in one bounded stacking context.

TSX
<Overlay position="bottom" showOn="hover" content={<span>Workspace overview</span>}>  <img src="/workspace.png" alt="Workspace dashboard" /></Overlay>
TSX
import { Overlay } from "@zentara-co/zenos-ui";

Overlay layers short content or actions over a bounded surface. It does not create a modal, portal, focus trap, or page backdrop.

hover also reveals when focus enters the overlay so keyboard users can reach its content. Use focus when pointer hover should not expose the layer, and always for persistent captions or controls. hover-or-focus remains a backwards-compatible alias for hover.

Turquoise Moraine Lake surrounded by evergreen forest and mountains
Always visible
Snow-capped Southern Alps reflected in Lake Matheson
Hover or focus
Minimal modern building with strong geometric shadows
Focus only

position="fill" uses a uniform layer. top and bottom use directional fades that remain strongest beside the content and reveal more of the media toward the opposite edge. Use align="start" with top content and align="end" with bottom content.

Turquoise Moraine Lake surrounded by evergreen forest and mountains
top
Snow-capped Southern Alps reflected in Lake Matheson
fill
Minimal modern building with strong geometric shadows
bottom

Dark and light scrims keep their visual polarity in both color schemes, so their foreground color remains predictable. Nested content should inherit the scrim color; when using a component with its own color prop, explicitly choose a color that contrasts with the selected scrim. Use scrim={false} only when custom content supplies its own readable surface.

Turquoise Moraine Lake surrounded by evergreen forest and mountains
Dark scrim
Minimal modern building with strong geometric shadows
Light scrim

Supply open when another control owns visibility and update it from onOpenChange. A closed controlled overlay becomes inert so hidden actions cannot receive focus. Touching a non-interactive area requests the next controlled state through onOpenChange.

Snow-capped Southern Alps reflected in Lake Matheson
Landscape details are visible

Use className for the bounded root and contentClassName for the positioned layer. This keeps layout customization separate from the media and lets a custom panel replace the built-in scrim without rebuilding visibility behavior. Pair semantic surface, border, and foreground tokens so the treatment maintains contrast in both light and dark modes; nested components with their own color styles should use the same foreground family.

Minimal modern building with strong geometric shadows

Architectural study

Minimal form · Light and shadow

Use Overlay for content that remains physically attached to a media or card surface. Use Popover for anchored floating content, Dialog for modal tasks, and Lightbox for fullscreen media viewing.

API

PropTypeDefaultDescription
content ReactNode — Content shown over children.
contentClassName string — Adds classes to the positioned content layer.
showOn OverlayShowOn always Visibility interaction; hover also reveals on focus for keyboard access.
scrim dark | light | false dark Theme-independent dark, light, or consumer-styled backdrop treatment.
position fill | top | bottom fill Uniform fill or directional top/bottom fade placement.
align start | center | end end Vertical content alignment within the positioned layer.
open boolean — Controlled visibility override.
defaultOpen boolean false Initial touch visibility for uncontrolled usage.
onOpenChange (open: boolean) => void — Runs when touch interaction requests a visibility change.
native props React.HTMLAttributes<HTMLDivElement> — Forwards native attributes, events, aria-*, data-*, className, style, and ref.

Unless narrowed above, each DOM-rendering part also accepts its underlying native or Base UI props, including className, style, aria-*, and data-*.

Overlay preserves the semantics of its children and content. Hover-revealed content also appears on focus-within, and controlled hidden content is inert. Keep essential information available without hover, provide meaningful alternative text for media, and maintain sufficient contrast for custom scrims. Touch taps toggle revealable overlays unless the tap targets an interactive element.