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>
);
}















