npx shadcn@4.23.1 add https://registry.goop.so/g/<link>/meadow-media-frame.json --yesMedia frame
ProA box for a photo, a map, a cover or an upload, at a fixed shape, holding a picture or, until there is one, its empty state, for React and Tailwind CSS. Part of Goop Pro.
What an agent sees
- MediaFrameImageThe picture
- MediaFrameMediaYour own media element (a
picture, avideo, a map) as the frame's picture - MediaFrameEmptyWhat the box shows until there is a picture
import { MediaFrameMedia } from '@/components/ui/goop/media-frame';
import { Button } from '@/components/ui/goop/button';
import { MediaFrame, MediaFrameEmpty, MediaFrameImage } from '@/components/ui/goop/media-frame';
<>
<MediaFrame ratio="square" className="w-60">
<MediaFrameEmpty action={<Button variant="outline">Choose photo</Button>}>No cover art yet</MediaFrameEmpty>
</MediaFrame>
<MediaFrame ratio="16/9">
<MediaFrameEmpty icon="map-2">The route map goes here</MediaFrameEmpty>
</MediaFrame>
<MediaFrame ratio="4/3" caption="The harbour from the north wall.">
<MediaFrameImage src="/harbour.jpg" alt="Boats in a harbour at dawn" fallback="Boats in a harbour at dawn" />
</MediaFrame>
</>Pick a look (each shape empty or holding media, a picture that fails to load, the frame in a card) or switch the shape (auto takes the media’s own height), turn loading on, hold the empty state with its icon and action, a block of media or a broken picture with its fallback (the icon or your own words), add a caption. No picture is loaded: the example ships no image, so the media is a plain block of our own, and the broken picture’s source is an empty address that never loads.
When to use
- A box for a photo, a map, a cover or an upload, at a fixed shape, holding a picture or, until there is one, its empty state.
- Use it wherever a picture will stand (a cover, a product photo, a map, an upload), never Empty or an Avatar bent into a box. Give it a width; the ratio gives its height.
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 Media frame 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-media-frame.json --yesAdd the Goop Media frame to this project. The install steps are at https://goop.so/docs/install.mdUsage
import { MediaFrameMedia } from '@/components/ui/goop/media-frame';
import { Button } from '@/components/ui/goop/button';
import { MediaFrame, MediaFrameEmpty, MediaFrameImage } from '@/components/ui/goop/media-frame';
<>
<MediaFrame ratio="square" className="w-60">
<MediaFrameEmpty action={<Button variant="outline">Choose photo</Button>}>No cover art yet</MediaFrameEmpty>
</MediaFrame>
<MediaFrame ratio="16/9">
<MediaFrameEmpty icon="map-2">The route map goes here</MediaFrameEmpty>
</MediaFrame>
<MediaFrame ratio="4/3" caption="The harbour from the north wall.">
<MediaFrameImage src="/harbour.jpg" alt="Boats in a harbour at dawn" fallback="Boats in a harbour at dawn" />
</MediaFrame>
</>- Fits: list, record: row (media: some).
- Also known as: AspectRatio, ImagePlaceholder, Figure.
- height, width, padding, gap, corner, background, text: add no class for these.
API reference
| Option | Type | What it does |
|---|---|---|
| ratio? | 'square' | '4/3' | '16/9' | 'auto' = '16/9' | The box's shape; auto the picture's own height. |
| loading? | boolean = false | While true the box holds a skeleton and says it is busy; the picture fades in after. |
| caption? | ReactNode | A line under the box saying what the picture shows; it names the figure. |
| children? | ReactNode | The picture (MediaFrameImage, or your own element in MediaFrameMedia) or its empty state (MediaFrameEmpty). |
| Part | What it is |
|---|---|
| MediaFrameImage | The picture; alt: string — What the picture shows, for a reader who cannot see it ("" for a picture that says nothing); fit?: 'cover' | 'contain' = 'cover' — cover fills the box, cutting the rest; contain shows the whole picture; fallback?: ReactNode — What the box shows when the picture fails to load: by default the pack icon photo-off on the frame's fill |
| MediaFrameMedia | Your own media element (a picture, a video, a map) as the frame's picture |
| MediaFrameEmpty | What the box shows until there is a picture; icon?: IconName — The pack icon over the words (default photo; map-2 for a map); action?: ReactNode — An action under the words: the theme's Button ("Choose photo"); children: ReactNode — One short line saying what goes here ("No photo yet") |
- data-slot values (to select a part by): media-frame, media-frame-box, media-frame-caption, media-frame-empty, media-frame-empty-action, media-frame-empty-icon, media-frame-empty-words, media-frame-fallback, media-frame-fallback-icon, media-frame-image, media-frame-media, media-frame-skeleton
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.