Skip to main content
a painting of a red, white, and blue object

Gallery Example

Profile picture for Karl Mantle
Karl Mantle Example role
| Development

astro-skeleton comes with the @astrojs/mdx integration installed and configured in the astro.config.mjs config file. If you prefer not to use MDX, you can disable support by removing the integration from your config file.

Why MDX?

MDX is a special flavor of Markdown that supports embedded JavaScript & JSX syntax. This unlocks the ability to mix JavaScript and UI Components into Markdown content for things like interactive charts or alerts.

If you have existing content authored in MDX, this integration will hopefully make migrating to Astro a breeze.

Example

Here is how to import and use the gallery MDX component:

When viewing this page in the browser, you should see the gallery above the code block.

Example 1
Example 2
Example 3
Example 4
import ImageGallery from "~/components/mdx/integrations/swiper/ImageGallery.astro";
import Image1 from "~/content/posts/images/claudio-schwarz-pQ_SEJg8rII-unsplash.jpg";
import Image2 from "~/content/posts/images/eugene-golovesov-k-ZgCSdH8Hk-unsplash.jpg";
import Image3 from "~/content/posts/images/fons-heijnsbroek-U8EuOr-hG_0-unsplash.jpg";
import Image4 from "~/content/posts/images/geronimo-giqueaux-H26GZk6nro8-unsplash.jpg";

<ImageGallery
  images={[
    { src: Image1, alt: "Example 1" },
    { src: Image2, alt: "Example 2" },
    { src: Image3, alt: "Example 3" },
    { src: Image4, alt: "Example 4" },
  ]}
/>

Post Details

Description

How to use the gallery component inside Markdown posts with MDX.

Related posts

  1. Gallery Example

    How to use the gallery component inside Markdown posts with MDX.

    a painting of a red, white, and blue object