Skip to main content
Version: 1.0.3

AspectRatio

Overview

The AspectRatio component ensures that its children maintain a specific width-to-height ratio, making it ideal for videos, images, or placeholders that need to be consistently sized across devices.

Preview

Demo Image

Installation

ignix add component aspect-ratio

Usage

Import the component:

import { AspectRatio } from '@ignix-ui';

Basic Usage

function BasicAspectRatio() {
return (
<AspectRatio ratio="4:3" maxWidth="500px">
<img src="https://thumbs.wbm.im/pw/medium/859204cf5b71808ed4c6bd19d95974c6.jpg" alt="Demo Image" />
</AspectRatio>
);
}

Variants

Demo Image