Aspect Ratio
Displays content within a desired aspect ratio, preserving proportions responsively across viewport sizes with ratio presets and skeleton loading placeholders.
import
import { AspectRatio } from "@/components/ui/aspectRatio/aspectRatio";$
npx @bloomui-react/cli add aspectRatioaspectRatio.tsx
Preset Ratios
Use predefined ratio aliases (video, square, golden, cinema, portrait, ultrawide).
preset:
video | square | golden | cinema | portrait | ultrawidepreset="video" (16:9)
preset="square" (1:1)
preset="cinema" (21:9)
Loading Skeleton Placeholder
Display a pulsing skeleton container while high-resolution media is loading.
isLoading: boolean
API Reference
Props — AspectRatio
Properties for configuring the AspectRatio component.
| Prop | Type | Default | Description |
|---|---|---|---|
| preset | 'video' | 'square' | 'golden' | 'cinema' | 'portrait' | 'ultrawide' | — | Preset aspect ratio alias. Takes precedence over custom numeric ratio. |
| ratio | number | 16 / 9 | Desired custom width-to-height numeric ratio (e.g. 16/9, 4/3, 1/1). |
| isLoading | boolean | false | Shows an integrated skeleton loading spinner state inside the container frame. |