Open this example in the interactive library
Live preview
Source code
// components/ExpandablePhotoCaption.tsx
export default function ExpandablePhotoCaption({
src = "/studio.jpg",
caption = "Inside the studio",
}: { src?: string; caption?: string } = {}) {
return (
<figure>
<img src={src} alt={caption} style={{ width: "100%" }} />
<details>
<summary>Image description</summary>
{caption}
</details>
</figure>
);
}
