Open this example in the interactive library
Source code
// components/ResponsiveNextImage.tsx
import Image from "next/image";
export default function ResponsiveNextImage({
src = "/studio.jpg",
alt = "Inside the studio",
}: { src?: string; alt?: string } = {}) {
return (
<Image
src={src}
alt={alt}
width={1200}
height={800}
sizes="(max-width: 700px) 100vw, 700px"
style={{ width: "100%", height: "auto" }}
/>
);
}
