Open this example in the interactive library
Live preview
Source code
// components/SquareCoverCrop.tsx
export default function SquareCoverCrop({
src = "/studio.jpg",
caption = "Inside the studio",
}: { src?: string; caption?: string } = {}) {
return (
<img
src={src}
alt={caption}
style={{ width: "min(100%,20rem)", aspectRatio: "1", objectFit: "cover" }}
/>
);
}
