Skip to main content
Version: 1.0.2

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

npx @mindfiredigital/ignix-ui add aspect-ratio

Usage

Import the component:

import { AspectRatio } from './components/ui';

Basic Usage

function BasicAspectRatio() {
return (
<AspectRatio ratio="4:3" maxWidth="500px">
<img src={image} alt="Demo Image" className="object-cover w-full h-full" />
</AspectRatio>
);
}

Variants

Demo Image