Open this example in the interactive library
Source code
// components/FillImageHero.tsx
import Image from "next/image";
export default function FillImageHero({
src = "/studio.jpg",
alt = "Inside the studio",
}: { src?: string; alt?: string } = {}) {
return (
<section style={{ position: "relative", height: "clamp(16rem,45vw,35rem)" }}>
<Image src={src} alt={alt} fill sizes="100vw" style={{ objectFit: "cover" }} />
</section>
);
}
