Skip to main content

Starwind UI v1.12 is now available!

Aspect Ratio

Photo by Drew Beamer

Installation

Usage

16:9 Ratio (Default Video)

16:9 Aspect Ratio

4:3 Ratio (Classic Photo)

Photo by Kari Shea

1:1 Ratio (Square)

Photo by Ayo Ogunseinde

21:9 Ratio (Ultrawide)

Photo by Simon Berger

With Video

API Reference

AspectRatio

A container component for maintaining consistent aspect ratios for media and content.

PropTypeDefault
rationumber1
asHTMLTag"div"
classstring-
<AspectRatio ratio={16 / 9}>
<img src="image.jpg" alt="Description" class="object-cover w-full h-full" />
</AspectRatio>

Additional Notes:

  • ratio: The aspect ratio (e.g., 16/9, 4/3, 1)
  • as: The HTML element to render as

Changelog

v1.0.0

  • Initial release with starwind v1.10.0