brijr/ui

Lab

Aspect Ratio

npx shadcn@latest add @brijr/aspect-ratio

Ratios · block

Each specimen is w-64.

16 / 9
ratio={16 / 9}
4 / 3
ratio={4 / 3}
1 / 1
ratio={1 / 1}
21 / 9
ratio={21 / 9}

Ratios · image

next/image with fill and object-cover inside the ratio box.

A blurred figure standing in the surf at dusk
ratio={16 / 9}
A blurred figure standing in the surf at dusk
ratio={4 / 3}
A blurred figure standing in the surf at dusk
ratio={1 / 1}
A blurred figure standing in the surf at dusk
ratio={21 / 9}

Widths

16 / 9 at w-40 and w-80; 21 / 9 at full width.

A blurred figure standing in the surf at dusk
w-40
A blurred figure standing in the surf at dusk
w-80
A blurred figure standing in the surf at dusk
w-full · 21 / 9

Portrait

Ratios below 1.

A blurred figure standing in the surf at dusk
ratio={3 / 4}
9 / 16
ratio={9 / 16}