npx shadcn@4.23.1 add https://registry.goop.so/g/<link>/meadow-carousel.json --yesCarousel
ProA 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.
What an agent sees
- CarouselItemOne picture of the strip
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>
);
}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.
npx shadcn@4.23.1 add https://registry.goop.so/g/<link>/meadow-carousel.json --yesAdd the Goop Carousel to this project. The install steps are at https://goop.so/docs/install.mdUsage
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
| Option | Type | What it does |
|---|---|---|
| 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). |
| Part | What it is |
|---|---|
| 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
| Key | What it does |
|---|---|
| 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.