Layout/Aspect Ratio

Aspect Ratio

Constrains its content to a fixed width-to-height ratio, staying responsive at any container width. Useful for images, video embeds, and cards.

import { AspectRatio } from "@animui/ui"

Basic (16 / 9)

16 / 9

Square (1 / 1)

1 / 1

Video embed

iframe / video content

Props

PropTypeDefaultDescription
rationumber16 / 9Width-to-height ratio to maintain, e.g. 16 / 9, 4 / 3, or 1 for a square.
childrenReactNodeContent to fill the ratio-constrained box, e.g. an image, video, or embed.
classNamestringAdditional classes for the outer container.

Accessibility

  • Purely a layout primitive; accessibility depends on the content passed as children (e.g. provide alt text on images).
  • Uses the native CSS aspect-ratio property, so it resizes fluidly with its container without JavaScript.
© 2026 Steal Shadow. MIT License.Report an issue