Dev Helpers

React / Media

Square cover crop

Dev Helpers · November 5, 2026

A square image crop gives a card grid consistent geometry. The crop anchor determines whether the most important part of a photo survives.

Worked example

// 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" }}
    />
  );
}

Implementation notes

An alternative text description should describe the image's purpose in this card. The same image can be informative in one place and decorative in another.

Try it yourself

Compare landscape art with an off-centre portrait.

Open the React example →

Editorial date November 5, 2026 · Published December 6, 2026

Related articles

Percentage meter

A percentage meter needs both a bounded visual fill and a meaningful textual value. Handle a zero denominator before dividing.

Vertical typesetting sample

Vertical typesetting changes the reading direction and available inline space. Treat the sample text as content so it remains selectable and accessible.

Batch weight summary

Batch weight combines quantity and unit weight. Convert all measurements to the same unit before aggregating them.