Aspect Ratio

Wrapper component that maintains a fixed ratio while letting the child fill the available slot. The Omni version applies the frosted panel and mono labelling used throughout the console.

Examples

Media Preview
Lock telemetry tiles or video stills to consistent dimensions without manual spacing.

Throughput

42.8k msg/s

Live
Workspace

Installation

pnpm dlx shadcn@latest add @omni/aspect-ratio

Usage

import { AspectRatio } from "@/components/ui/aspect-ratio"
<AspectRatio ratio={16 / 9}>
  <div className="absolute inset-0 bg-gradient-to-br from-slate-800 via-transparent to-slate-900" />
  <div className="absolute inset-0 flex items-end justify-between p-4">
    <span className="font-mono text-[10px] uppercase tracking-[0.32em]">Region</span>
    <span className="text-sm">Tokyo</span>
  </div>
</AspectRatio>