Open this example in the interactive library
Live preview
Source code
// components/CaptionedResponsivePhoto.tsx
export default function CaptionedResponsivePhoto({
src = "/studio.jpg",
caption = "Inside the studio",
}: { src?: string; caption?: string } = {}) {
return (
<figure>
<img
src={src}
alt={caption}
loading="lazy"
style={{ maxWidth: "100%", height: "auto" }}
/>
<figcaption>{caption}</figcaption>
</figure>
);
}
