Skip to main content

Starwind UI v3.0 beta is now available! Read the migration guide

Aspect Ratio

Photo by Drew Beamer

Installation

Framework Availability

Astro Available React Available

Aspect Ratio is available for Astro and React.

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

Styled Component API

These props are added or materially changed by the installed Astro styled component. Standard HTML attributes remain available through the inherited interfaces noted below. Follow the Primitive and Runtime links for lower-level behavior props.

Aspect Ratio

Inherits div attributes.

Contains the following additional props:

Prop Type Default Toggle details
as keyof HTMLElementTagNameMap "div"
Description
Selects the rendered element or component.
Classification
Wrapper prop
ratio number 1
Description
Sets the rendered width-to-height ratio.
Classification
Wrapper prop

Changelog

v1.1.0

  • Added contract-generated Astro and React implementations while preserving the component’s existing public API and styling.

v1.0.3

  • Refactor tailwind variants functions into separate variants.ts file

v1.0.0

  • Initial release with starwind v1.10.0