Skip to content

Screenshots

The Screenshot component renders theme-aware images that automatically switch between light and dark variants when the user toggles the site theme. Use it whenever you need to show UI screenshots that should match the reader’s current color scheme.

PropTypeRequiredDescription
lightstringNoPath to the light-mode image
darkstringNoPath to the dark-mode image
altstringYesAlt text for accessibility
widthnumberNoImage width in pixels
heightnumberNoImage height in pixels

Provide both light and dark props to show the correct variant for each theme. Toggle the theme selector in the top-right corner to see the image switch.

Docs theme homepage Docs theme homepage
import Screenshot from '@f5xc-salesdemos/docs-theme/components/Screenshot.astro';
<Screenshot
light="/images/screenshot-example-light.png"
dark="/images/screenshot-example-dark.png"
alt="Docs theme homepage"
/>

When only one variant is available, pass just light or dark. The image renders in both themes without swapping.

Docs theme homepage (dark only)
<Screenshot
dark="/images/screenshot-example-dark.png"
alt="Docs theme homepage (dark only)"
/>

Use width and height to control the rendered size and prevent layout shift.

Docs theme homepage at fixed width Docs theme homepage at fixed width
<Screenshot
light="/images/screenshot-example-light.png"
dark="/images/screenshot-example-dark.png"
alt="Docs theme homepage at fixed width"
width={600}
height={338}
/>

The component renders one or two <img> elements inside a .screenshot-pair wrapper. CSS rules toggle visibility based on the active theme:

  • Dark mode (default) — the .screenshot-light image is hidden via :root:not([data-theme="light"]) .screenshot-light \{ display: none \}
  • Light mode — the .screenshot-dark image is hidden via :root[data-theme="light"] .screenshot-dark \{ display: none \}

Additional selectors handle the starlight-image-zoom wrapper using :has() so zoom functionality works correctly with both variants.

All screenshot images receive consistent styling: a subtle border, rounded corners, and a drop shadow that intensifies on hover.

FeatureScreenshot componentMarkdown ![](url)
Theme-aware swappingYesNo
Styled border and shadowAutomaticNo
Hover shadow effectYesNo
Zoom supportWorks with image zoom pluginWorks with image zoom plugin
Alt textalt prop![alt text]()

Use the Screenshot component when you have theme-specific image variants or want the styled screenshot appearance. Use standard Markdown images for inline graphics, diagrams, or images that look the same in both themes.