---
title: Gallery Blocks for Astro
description: "Astro image galleries with a centered project carousel, a hover grid, and text overlays."
seo:
    title: "Astro Gallery blocks: examples and source"
sidebar:
    label: "Gallery"
related:
    - /blocks
    - /components
    - /docs/astro-business-websites
mode: wide
---

## Projects carousel

Browse project images with captions and carousel controls.

```astro
---
import ProjectsCarousel from "@/components/blocks/gallery/projects-carousel.astro"
import hall from "../../../src/assets/images/entrance-hall.png"
import lake from "../../../src/assets/images/mountain-beyond-lake-scene.png"
import moon from "@/assets/wizard/wizard-on-moon.jpeg"
import spaceship from "@/assets/wizard/wizard-spaceship.png"
---

<ProjectsCarousel
  label="gnostic AI sample image-tagging pilot"
  slides={[
    {
      title: "Choose the source images",
      description:
        "Start with six illustrations. What words would an editor use to find each one?",
      image: { src: spaceship, alt: "A white spaceship in a forest clearing" },
      href: "/blocks/gallery#bento-image-links",
      button: "Browse the six illustrations",
    },
    {
      title: "Check the suggested tags",
      description:
        "Compare four suggestions with the pictures. Decide which tags to keep and which to change.",
      image: { src: moon, alt: "Earth above the lunar horizon" },
      href: "/blocks/content#features-tabs",
      button: "Review four tags",
    },
    {
      title: "Try three more pictures",
      description:
        "Write a search tag for the lake, hall, and field before you read the sample decisions.",
      image: { src: hall, alt: "An illustrated entrance hall" },
      href: "/blocks/gallery#image-carousel",
      button: "See the three test images",
    },
    {
      title: "Compare your decisions",
      description:
        "See why the reviewer kept a landscape tag, changed a building tag, and removed a place name.",
      image: { src: lake, alt: "Mountain ridge beyond a lake" },
      href: "/blocks/gallery#case-study-carousel",
      button: "Read the review notes",
    },
  ]}
/>
```

```sh
bunx --bun shadcn@latest add @gnostic/projects-carousel
```

The selected project appears at full size with its title, description, and link.
Side images are smaller and dimmed. Select a side image, use the arrow buttons,
or use the dots below the images. The dots sit on the right.

Pass a `slides` array. Each slide has `title`, `description`, `href`, `button`,
and `image`. The image has `src` and `alt`. Its source can be a string or an
imported Astro image. String sources can also supply `width` and `height`.
Set `label` to give the carousel an accessible name.

An empty array renders no block. One project renders at full width without
navigation controls. Image dimensions and the square frame keep the layout
stable while images load.

## Bento image links

Use a grid of labeled images to link to individual projects. Set an item's `class` to let it span more than one row or column.

```astro
---
import BentoImageLinks from "@/components/blocks/gallery/bento-image-links.astro"
import moon from "@/assets/wizard/wizard-on-moon.jpeg"
import dock from "@/assets/images/spaceship-docking-in-ocean.png"
import field from "@/assets/wizard/wizard-in-field-looking-at-planet.png"
import ship from "@/assets/wizard/wizard-spaceship.png"
import clouds from "@/assets/wizard/wizard-above-clouds.jpeg"
import cove from "@/assets/wizard/wizard-in-cove.png"
---

<BentoImageLinks
  title="Six illustrations for an image-tagging pilot"
  subtitle="Open a source image from the gnostic AI sample collection. Which tags would help an editor find it again?"
  action={{
    label: "Review four sample tags",
    href: "/blocks/content#features-tabs",
  }}
  items={[
    {
      name: "Earth above the Moon",
      href: moon.src,
      image: { src: moon, alt: "Earth above the lunar ridge" },
      class: "@md:col-span-2 @2xl:row-span-2",
    },
    {
      name: "Spaceship by the coast",
      href: dock.src,
      image: {
        src: dock,
        alt: "A spaceship above the water beside a coastal road",
      },
    },
    {
      name: "Planet above a field",
      href: field.src,
      image: {
        src: field,
        alt: "A path through a field beneath a giant planet",
      },
    },
    {
      name: "Spaceship in a clearing",
      href: ship.src,
      image: { src: ship, alt: "A white spaceship in a forest clearing" },
    },
    {
      name: "Airships above the clouds",
      href: clouds.src,
      image: { src: clouds, alt: "Airships above the clouds at sunset" },
    },
    {
      name: "Cave by a stream",
      href: cove.src,
      image: { src: cove, alt: "A glowing cave beside a mountain stream" },
      class: "@md:@max-2xl:col-span-2",
    },
  ]}
/>
```

```sh
bunx --bun shadcn@latest add @gnostic/bento-image-links
```

## Expanding gallery

Pass `images` to `ExpandingGallery` for an image grid. Use `rows`, `columns`, `gap`, and `scaleFactor` to configure it. This two-row grid shows six illustrations from the gnostic AI image-tagging pilot.

```astro
---
import ExpandingGallery from "@/components/blocks/gallery/expanding-gallery/expanding-gallery.astro"
import wizardSmallStreet from "@/assets/wizard/wizard-small-street.png"
import thePortal from "@/assets/images/the-portal.png"
import beachAlien from "@/assets/images/beach-on-alien-planet.png"
import cloudsPlate from "@/assets/wizard/wizard-above-clouds.png"
import entranceHall from "@/assets/images/entrance-hall.png"
import wizardLookingShip from "@/assets/wizard/wizard-looking-at-spaceship.png"
---

<ExpandingGallery
  images={[
    {
      src: wizardSmallStreet,
      alt: "A wizard on a stone road between cottages and red trees",
    },
    { src: thePortal, alt: "A figure below a circular opening in a rock face" },
    { src: beachAlien, alt: "Two crescent shapes above a shore at sunset" },
    { src: cloudsPlate, alt: "A pilot facing a castle above the clouds" },
    { src: entranceHall, alt: "Figures facing a tall blue-lit doorway" },
    {
      src: wizardLookingShip,
      alt: "A wizard beside a spacecraft resting on open ground",
    },
  ]}
  rows={2}
  columns={3}
  gap="0.75rem"
  scaleFactor={0.8}
/>
```

```sh
bunx --bun shadcn@latest add @gnostic/expanding-gallery
```

### Labeled panels

Pass `panels` to show the same six illustrations in one row. Each vertical title is a suggested search tag. Open a panel to read the reviewer's decision and follow its link to inspect the original image.

Hover or tap a panel to open it. With a keyboard, use the arrow keys to select a panel, then press Tab to reach its link.

```astro
---
import ExpandingGallery from "@/components/blocks/gallery/expanding-gallery/expanding-gallery.astro"
import portal from "@/assets/images/the-portal.png"
import shore from "@/assets/images/beach-on-alien-planet.png"
import village from "@/assets/wizard/wizard-small-street.png"
import hall from "@/assets/images/entrance-hall.png"
import clouds from "@/assets/wizard/wizard-above-clouds.png"
import ship from "@/assets/wizard/wizard-looking-at-spaceship.png"

const tagReviews = [
  {
    title: "Village",
    description: "Keep “village.” Cottages line the wizard’s route.",
    image: village,
  },
  {
    title: "Tunnel",
    description: "Use “rock opening.” The opening frames the sky.",
    image: portal,
  },
  {
    title: "Shoreline",
    description: "Keep “shoreline.” The water meets a curved stretch of sand.",
    image: shore,
  },
  {
    title: "Ocean",
    description:
      "Use “clouds.” The white layer sits below the pilot and the castle.",
    image: clouds,
  },
  {
    title: "Doorway",
    description:
      "Keep “doorway.” A tall opening glows blue behind the figures.",
    image: hall,
  },
  {
    title: "Launch",
    description:
      "Use “spacecraft.” The ship rests on the ground beside the wizard.",
    image: ship,
  },
]
---

<ExpandingGallery
  label="gnostic AI sample image tag review"
  panels={tagReviews.map(({ title, description, image }) => ({
    title,
    description,
    image: { src: image, alt: "", width: 640 },
    href: image.src,
    linkLabel: "Open source image",
  }))}
/>
```

```sh
bunx --bun shadcn@latest add @gnostic/expanding-gallery
```

<AutoTypeTable
    path="../../packages/ui/src/components/blocks/gallery/expanding-gallery/types.ts"
    name="ExpandingGalleryPanel"
/>

## Project columns

```astro
---
import Block from "@/components/blocks/gallery/gallery-project-columns.astro"
import { getImage } from "astro:assets"
import lake from "../../../src/assets/images/mountain-beyond-lake-scene.png"
import hall from "../../../src/assets/images/entrance-hall.png"
import field from "../../../src/assets/images/open-field-illustration.png"

const lakeUrl = (await getImage({ src: lake, width: 1200, format: "webp" })).src
const hallUrl = (await getImage({ src: hall, width: 1200, format: "webp" })).src
const fieldUrl = (await getImage({ src: field, width: 1200, format: "webp" }))
  .src
const content = {
  title: "gnostic AI sample automation projects",
  projectsLabel: "Browse the field notes",
  contact: {
    label: "View the sample project brief",
    href: "/blocks/contact#editorial-contact",
  },
  projectsHref: "/blocks/articles#image-grid",
  aboutHref: "/blocks/services#process",
  portrait: {
    title: "How gnostic AI tests a pilot",
    image: {
      src: hallUrl,
      alt: "An illustrated entrance hall",
    },
  },
  projects: [
    {
      src: lakeUrl,
      alt: "Mountain ridge beyond a lake",
      name: "Ticket routing",
      label: "Read the ticket routing field note",
      href: "/blocks/article#image-header",
    },
    {
      src: hallUrl,
      alt: "An illustrated entrance hall",
      name: "Reply review",
      label: "Read the reply review field note",
      href: "/blocks/article#centered-header",
    },
    {
      src: fieldUrl,
      alt: "Illustration of an open field",
      name: "Invoice intake",
      label: "Read the invoice intake field note",
      href: "/blocks/article#editorial-article",
    },
  ],
}
---

<Block {...content} />
```

```sh
bunx --bun shadcn@latest add @gnostic/gallery-project-columns
```

## Editorial projects

Use this section for the projects part of a studio site.

```astro
---
import Section from "@/components/blocks/portfolio/portfolio-project-list/portfolio-project-list.astro"
import { getImage } from "astro:assets"
import lake from "../../../src/assets/images/mountain-beyond-lake-scene.png"
import hall from "../../../src/assets/images/entrance-hall.png"
import field from "../../../src/assets/images/open-field-illustration.png"

const lakeUrl = (await getImage({ src: lake, width: 1200, format: "webp" })).src
const hallUrl = (await getImage({ src: hall, width: 1200, format: "webp" })).src
const fieldUrl = (await getImage({ src: field, width: 1200, format: "webp" }))
  .src
const section = {
  label: "gnostic AI · Sample projects",
  title: "Three workflows",
  accent: "to test in a pilot",
  action: {
    label: "View the sample project brief",
    href: "/blocks/contact#editorial-contact",
  },
  projects: [
    {
      title: "Ticket routing",
      description:
        "Test whether a billing request and a setup question reach their queues, then follow a mixed request to a reviewer.",
      image: {
        src: lakeUrl,
        alt: "Mountain ridge beyond a lake",
      },
      tags: ["Support operations"],
      awards: [],
      href: "/blocks/article#image-header",
    },
    {
      title: "Reply review",
      description:
        "Check a draft reply about return packaging against the policy passage that applies to fragile items.",
      image: {
        src: hallUrl,
        alt: "An illustrated entrance hall",
      },
      tags: ["Customer support"],
      awards: [],
      href: "/blocks/article#centered-header",
    },
    {
      title: "Invoice intake",
      description:
        "Trace a disputed charge from a draft invoice record to the purchase order and the accounts reviewer.",
      image: {
        src: fieldUrl,
        alt: "Illustration of an open field",
      },
      tags: ["Accounts payable"],
      awards: [],
      href: "/blocks/article#editorial-article",
    },
  ],
}
---

<Section {...section} />
```

```sh
bunx --bun shadcn@latest add @gnostic/portfolio-project-list
```

<AutoTypeTable
    path="../../packages/ui/src/components/blocks/portfolio/portfolio-project-list/types.ts"
    name="PortfolioProjectListProps"
/>

See [serif accent font setup](/ui/docs/installation#serif-accent-fonts-for-editorial-blocks) when installing this section.

## Project results

```astro
---
import Block from "@/components/blocks/gallery/gallery-project-results/gallery-project-results.astro"
import { getImage } from "astro:assets"
import lake from "../../../src/assets/images/mountain-beyond-lake-scene.png"
import hall from "../../../src/assets/images/entrance-hall.png"
import field from "../../../src/assets/images/open-field-illustration.png"

const lakeUrl = (await getImage({ src: lake, width: 1200, format: "webp" })).src
const hallUrl = (await getImage({ src: hall, width: 1200, format: "webp" })).src
const fieldUrl = (await getImage({ src: field, width: 1200, format: "webp" }))
  .src
const content = {
  eyebrow: "gnostic AI · Sample projects",
  title: "What the pilot tests revealed",
  note: "Results from the sample field notes.",
  stats: [
    {
      value: "3",
      label: "Sample tickets",
      description: "Billing, setup, and a request that covers both.",
    },
    {
      value: "$24",
      label: "Disputed charge",
      description: "The $264 invoice exceeds the $240 order.",
    },
  ],
  projects: [
    {
      title: "Ticket routing",
      label: "Support operations",
      details: ["Mixed request", "A reviewer assigns the queue."],
      image: {
        src: lakeUrl,
        alt: "Mountain ridge beyond a lake",
      },
    },
    {
      title: "Reply review",
      label: "Customer support",
      details: [
        "Item unspecified",
        "The agent asks which item the customer bought.",
      ],
      image: {
        src: hallUrl,
        alt: "An illustrated entrance hall",
      },
    },
    {
      title: "Invoice intake",
      label: "Accounts payable",
      details: [
        "Totals differ",
        "The accounts team checks the extra charge before posting.",
      ],
      image: {
        src: fieldUrl,
        alt: "Illustration of an open field",
      },
    },
  ],
}
---

<Block {...content} />
```

```sh
bunx --bun shadcn@latest add @gnostic/gallery-project-results
```

## Case study carousel

Supply your own content. The section uses the selected project preset.

```astro
---
import Block from "@/components/blocks/content/content-case-carousel/content-case-carousel.astro"
import type { CaseCarouselContent } from "@/components/blocks/content/content-case-carousel/types"
import { getImage } from "astro:assets"
import lake from "../../../src/assets/images/mountain-beyond-lake-scene.png"
import hall from "../../../src/assets/images/entrance-hall.png"
import field from "../../../src/assets/images/open-field-illustration.png"

const lakeUrl = (await getImage({ src: lake, width: 1200, format: "webp" })).src
const hallUrl = (await getImage({ src: hall, width: 1200, format: "webp" })).src
const fieldUrl = (await getImage({ src: field, width: 1200, format: "webp" }))
  .src
const content = {
  label: "gnostic AI · Sample review notes",
  title: "Which tags passed the image check?",
  cases: [
    {
      title: "Keep “mountain lake”",
      description:
        "The ridge and the water are both visible. An editor searching for a mountain lake could use this image.",
      image: {
        src: lakeUrl,
        alt: "Mountain ridge beyond a lake",
      },
      label: "Keep",
    },
    {
      title: "Change “hotel” to “entrance hall”",
      description:
        "The picture shows a hall. It gives no clue about what the building is used for.",
      image: {
        src: hallUrl,
        alt: "An illustrated entrance hall",
      },
      label: "Change",
    },
    {
      title: "Remove “Yorkshire”",
      description:
        "Keep the existing “open field” tag. Add the place name only if the illustrator can confirm it.",
      image: {
        src: fieldUrl,
        alt: "Illustration of an open field",
      },
      label: "Remove",
    },
  ],
} satisfies CaseCarouselContent
---

<Block {content} />
```

```sh
bunx --bun shadcn@latest add @gnostic/content-case-carousel
```

<AutoTypeTable
    path="../../packages/ui/src/components/blocks/content/content-case-carousel/types.ts"
    name="CaseCarouselProps"
/>

## Image carousel

Supply your own content. The section uses the selected project preset.

```astro
---
import Block from "@/components/blocks/content/content-image-carousel/content-image-carousel.astro"
import type { ImageCarouselContent } from "@/components/blocks/content/content-image-carousel/types"
import { getImage } from "astro:assets"
import lake from "../../../src/assets/images/mountain-beyond-lake-scene.png"
import hall from "../../../src/assets/images/entrance-hall.png"
import field from "../../../src/assets/images/open-field-illustration.png"

const lakeUrl = (await getImage({ src: lake, width: 1200, format: "webp" })).src
const hallUrl = (await getImage({ src: hall, width: 1200, format: "webp" })).src
const fieldUrl = (await getImage({ src: field, width: 1200, format: "webp" }))
  .src
const content = {
  label: "gnostic AI · Image-tagging pilot",
  title: "Which tags would you give these three images?",
  images: [
    {
      src: lakeUrl,
      alt: "Mountain ridge beyond a lake",
    },
    {
      src: hallUrl,
      alt: "An illustrated entrance hall",
    },
    {
      src: fieldUrl,
      alt: "Illustration of an open field",
    },
  ],
} satisfies ImageCarouselContent
---

<Block {content} />
```

```sh
bunx --bun shadcn@latest add @gnostic/content-image-carousel
```

<AutoTypeTable
    path="../../packages/ui/src/components/blocks/content/content-image-carousel/types.ts"
    name="ImageCarouselProps"
/>

## Make your own layout

The block uses [Carousel](/ui/components/carousel) with `variant="parallax"`.
Use the base carousel's `image` and `overlay` slots when you need your own
caption layout. Use only the `image` slot for an image gallery. The base
carousel supplies the effect, selected state, and dot navigation.

## Responsive layout and images

Each slide uses 70% of the carousel width in a narrow container. In a wide
container, each slide uses half the width. One project always uses the full
width. Keep titles and descriptions short so they fit over the image on mobile.

Images fill a square frame and crop to fit. Use images whose subject stays
visible in a square crop. Supply useful `alt` text and image dimensions. Imported
Astro images supply their dimensions automatically.
