---
agent:
  instructions: "Search goop.so for Goop's components, templates, design skill, docs, pricing and terms. Ask in keywords or a plain question, such as \"date picker props\" or \"is the design skill free\"; the answer is the matching page sections in Markdown, each with its address."
  endpoint: "https://goop.so/.well-known/search?q={query}"
  method: "GET"
  documentation: "https://developers.cloudflare.com/ai-search/how-to/search-for-agents/"
---

# Carousel

A strip of pictures that scroll sideways, two in view, with previous and next buttons, for a gallery or a product's photos, for React and Tailwind CSS. Part of Goop Pro.

Pro. Its export: `Carousel`.

## Try it

Step the strip with the narrow controls at its edges (each hides at its end), or scroll it sideways; press a panel to open it large, and close it with Escape or the cross.

The panels are colour blocks of our own standing in for photographs.

## When to use

- A strip of pictures that scroll sideways, two in view, with previous and next buttons, for a gallery or a product's photos.
- Also called: slideshow or image slider.

## Installation

Paste the prompt below into your coding agent. It reads Goop's install steps, installs the part and its tokens once, then reuses this same Carousel on every screen instead of drawing a new one: the same height, the same focus ring, the same spacing. As a Pro part, its command comes from Goop's server once you sign in, with a one-time link that lasts ten minutes.

```sh
npx shadcn@4.23.1 add https://registry.goop.so/g/<link>/meadow-carousel.json --yes
```

```text
Add the Goop Carousel to this project. The install steps are at https://goop.so/docs/install.md
```

## Usage

```tsx
import { Carousel, CarouselItem } from '@/components/ui/goop/carousel';

const PHOTOS = [
  { id: 'desk', title: 'Front desk', src: '/photos/desk.jpg' },
  { id: 'visit', title: 'Home visit', src: '/photos/visit.jpg' },
  { id: 'library', title: 'Library day', src: '/photos/library.jpg' },
];

function SiteVisitPhotos({ onOpen }: { onOpen?: (id: string) => void }) {
  return (
    <Carousel aria-label="Site visit photos" previousLabel="Previous photo" nextLabel="Next photo">
      {PHOTOS.map((photo) => (
        <CarouselItem key={photo.id} buttonLabel={`Open ${photo.title}`} onClick={() => onOpen?.(photo.id)}>
          <img src={photo.src} alt={photo.title} className="aspect-3/2 w-full object-cover" />
        </CarouselItem>
      ))}
    </Carousel>
  );
}
```

- Fits: record: header (media: primary).
- height, width, padding, corner: add no class for these.

## API reference

### Options

- `previousLabel?: string = 'Previous pictures'` — The previous control's name for a screen reader.
- `nextLabel?: string = 'Next pictures'` — The next control's name for a screen reader.
- `positionLabel?: (position: number, count: number) => string` — The words a screen reader is told when the strip moves ("2 of 5" by default).

### Parts

- `CarouselItem` — One picture of the strip; children: ReactNode — The picture, an `img` or your own, at the slide's width; buttonLabel?: string = 'Open picture' — The picture's button's spoken name, with `onClick`; onClick?: ComponentProps<'button'>['onClick'] — What a press on the picture does (open it large); without it, no button

- data-slot values (to select a part by): carousel, carousel-cell, carousel-frame, carousel-item, carousel-item-button, carousel-next, carousel-next-icon, carousel-position, carousel-previous, carousel-previous-icon, carousel-track, carousel-viewport

## Keyboard

- Tab: move to each picture's button, then to the live arrows
- Enter / Space: press the focused arrow or picture
- ArrowLeft / ArrowRight: step the strip one picture back or on, from anywhere in it, right to left mirrored
- Home / End: glide the strip to the first or the last picture

## Accessibility

- The native element answers the keyboard.

## Notes for AI

Give your coding agent this page as text instead of screenshots: the parts, the options, the states and the keys. An agent that reads the real part builds the real part, not a lookalike.

## Related

- [Meta facts](/themes/meadow/components/meta-facts): A strip of a record's short facts, such as its status, owner and dates, each a label over its value.
- [Inline code](/themes/meadow/components/inline-code): A word or short phrase of code inside running text (a template word, a key, a path), in a small grey chip in the theme's mono.
- [Code block](/themes/meadow/components/code-block): A short value or command in the theme's mono, in a grey box, with a copy button beside it that copies it and says so.
- [Prose](/themes/meadow/components/prose): A block of running text set for reading, one paragraph or several, for a description, an article, a note or a help page.
