Dev Helpers

Next.js / Optimized media

Small avatar image

Dev Helpers · September 24, 2025

Image geometry and alternative text still matter at avatar size. Reserve width and height to prevent a row from shifting while the image loads.

Worked example

// components/SmallAvatarImage.tsx

import Image from "next/image";

export default function SmallAvatarImage({
  src = "/studio.jpg",
  alt = "Inside the studio",
}: { src?: string; alt?: string } = {}) {
  return (
    <Image
      src={src}
      alt={alt}
      width={64}
      height={64}
      style={{ borderRadius: "50%", objectFit: "cover" }}
    />
  );
}

Implementation notes

Small avatars can still cause a large cumulative layout shift in long lists. Reserve dimensions consistently across placeholder and loaded states.

Try it yourself

Test a broken image and a user whose name appears immediately next to it.

Open the Next.js example →

Editorial date September 24, 2025 · Published December 6, 2026

Related articles

Free bin volume

Free storage volume depends on consistent dimensions and units. Derive capacity and usage in the same unit before formatting a human-readable summary.

Draft preview indexing

Draft pages need deliberate indexing metadata. An indexing directive controls crawler intent, while access to unpublished material needs a separate permission check.

Party size allocation

Allocating a party into groups is an integer problem. The remainder determines whether another group is needed and how full it will be.