EXEPERTAI LAB

Research alpha

Time Machine
EXEPERTAI LAB
GALLERY / COLLECTION
← Browse Astryx gallery
Overlay·component·@astryxdesign/core

Overlay

Overlay layers action or supporting content over media, cards, video, or other bounded surfaces with an optional scrim and reveal behavior.

Open in Playground @astryxdesign/core/Overlay

Showcases and examples

3 documented examples

Overlay

A media card with an always-visible scrim and centered action content.

Preview loads on approachPreview loads on approach
Exact source · overlay-showcase
// Copyright (c) Meta Platforms, Inc. and affiliates.

'use client';

import {Overlay} from '@astryxdesign/core/Overlay';
import {AspectRatio} from '@astryxdesign/core/AspectRatio';
import {Button} from '@astryxdesign/core/Button';
import {VStack} from '@astryxdesign/core/Layout';
import {Text} from '@astryxdesign/core/Text';

export default function OverlayShowcase() {
  return (
    <Overlay
      align="center"
      content={
        <VStack gap={2} style={{textAlign: 'center'}}>
          <Text type="supporting" weight="bold" color="inherit">
            Design system foundations
          </Text>
          <Button label="Open gallery" variant="secondary" size="sm" />
        </VStack>
      }>
      <AspectRatio
        ratio={16 / 9}
        style={{
          width: 520,
          maxWidth: '100%',
          borderRadius: 16,
          overflow: 'clip',
        }}>
        <img
          src="/template-assets/light-scene-horizontal-1.png"
          alt="Abstract landscape"
          style={{width: '100%', height: '100%', objectFit: 'cover'}}
        />
      </AspectRatio>
    </Overlay>
  );
}

Usage

Overlay layers action or supporting content over media, cards, video, or other bounded surfaces with an optional scrim and reveal behavior.

  • Use overlays for short, contextual actions or labels that belong directly to the underlying media or surface.
  • Keep overlay content compact so it remains legible over the scrim and does not obscure important visual information.
  • Do not use Overlay for floating content anchored outside the surface. Use Popover, Tooltip, or Dialog for those patterns.

Typed props

PropType and behavior
contentReactNode · required
Content rendered inside the overlay scrim.
Slot: Button, Text
childrenReactNode
Base content such as an image, video, card, or media surface that the overlay sits on top of.
showOn'hover' | 'always' | 'focus' | 'hover-or-focus' · default 'always'
Visibility trigger. Hover mode also reveals on focus for keyboard accessibility; hover-or-focus is an alias for hover.
isOpenboolean
Controlled visibility override. When set, this takes precedence over showOn and touch toggle behavior.
scrim'dark' | 'light' | false · default 'dark'
Scrim background mode. Set to false to render overlay content without a scrim background.
position'fill' | 'bottom' | 'top' · default 'fill'
Where the scrim appears within the base surface.
align'start' | 'center' | 'end' · default 'end'
Alignment of the overlay content within the scrim.
xstyleStyleXStyles
StyleX styles for layout customization (margins, positioning, sizing). Must be a stylex.create() value, not an inline style object like style={{}}.
classNamestring
CSS class name(s) appended to the root element. Prefer xstyle for styling when possible.
styleReact.CSSProperties
Inline styles applied to the root element. Prefer xstyle for design-system styling.
refRef<HTMLDivElement>
Ref forwarded to the overlay root element.

Anatomy

Base content · optional

The media, card, or bounded surface that the overlay sits on top of.

Scrim · optional

Optional dark or light overlay background that improves content contrast.

Overlay content · required

Actions, labels, or supporting content rendered above the base surface.

Theming

Targets

astryx-overlay
astryx-overlay-scrim

Visual props: position