Astryx

Astryx Overlay

CTAs

About

Overlay layers action or supporting content over media, cards, video, or other bounded surfaces with an optional scrim and reveal behavior. Host attributes and DOM handlers (id, data-*, aria-*) reach the root element. Astryx by Meta. Source: https://astryx.atmeta.com/components/Overlay

Built with React and Tailwind. Copy the prompt and paste it into Claude Code, Cursor or Lovable: your agent adds Astryx Overlay to your project and fits it to your theme.

Code

How Astryx Overlay is used: the demo's code. The component's own source comes with a free account.

Usage.tsx

'use client';

/* Copyright (c) 2026 Meta Platforms, Inc. See the MIT notice in astryx-overlay.tsx. */

import '@/components/ui/astryx-overlay-utils/astryx-preview.css';
import '@astryxdesign/theme-neutral/fonts.css';
import {useSyncExternalStore} from 'react';
import {Theme} from '@astryxdesign/core/theme';
import {neutralTheme} from '@astryxdesign/theme-neutral/built';

import {Overlay} from '@/components/ui/astryx-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';
import {useToast} from '@astryxdesign/core/Toast';

function OfficialSample() {
  const showToast = useToast();
  return (
    <Overlay
      style={{width: '100%', minWidth: 0}}
      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"
            onClick={() =>
              showToast({body: 'Demo: the gallery would open here'})
            }
          />
        </VStack>
      }>
      <AspectRatio
        ratio={16 / 9}
        style={{
          width: 520,
          maxWidth: '100%',
          borderRadius: 16,
          overflow: 'clip',
        }}>
        <img
          src="https://astryx.atmeta.com/_next/image?url=%2Ftemplate-assets%2Flight-scene-horizontal-1.png&w=1920&q=75"
          alt="Abstract landscape"
          style={{width: '100%', height: '100%', objectFit: 'cover'}}
        />
      </AspectRatio>
    </Overlay>
  );
}

function readPreviewMode() {
  const {classList} = document.documentElement;
  return classList.contains('dark') ? 'dark' : 'light';
}

function subscribeToPreviewMode(callback: () => void) {
  const observer = new MutationObserver(callback);
  observer.observe(document.documentElement, {attributes: true, attributeFilter: ['class']});
  return () => observer.disconnect();
}

export default function Demo() {
  const mode = useSyncExternalStore(subscribeToPreviewMode, readPreviewMode, () => 'light' as const);
  return (
    <Theme theme={neutralTheme} mode={mode}>
      <div className="astryx-demo">
        <div className="astryx-demo-content" data-centered style={{maxWidth: 520}}>
          <OfficialSample />
        </div>
      </div>
    </Theme>
  );
}

Dependencies

More by Astryx

View all
  • Astryx Banner

    Astryx Banner

    61
  • Astryx Avatar

    Astryx Avatar

    34
  • Astryx Aspect Ratio

    Astryx Aspect Ratio

    32
  • Astryx Badge

    Astryx Badge

    30
  • Astryx Button Group

    Astryx Button Group

    29
  • Astryx Chat Composer Drawer

    Astryx Chat Composer Drawer

    27
  • Astryx Toggle Button

    Astryx Toggle Button

    17
  • Astryx Chat Tokenized Text

    Astryx Chat Tokenized Text

    12

More in CTAs

View all
  • Hills Landscape Footer with Call to Action

    Hills Landscape Footer with Call to Action

    373
  • call to action

    call to action

    39
  • Responsive Hero Banner

    Responsive Hero Banner

    2.2K
  • Hero

    Hero

    1.4K
  • Call to action

    Call to action

    186
  • Newsletter Signup Section

    Newsletter Signup Section

    59
  • Button

    Button

    165
  • Centered Hero with Image Fan

    Centered Hero with Image Fan

    1.1K