UIComponentsReact
A box that keeps the width to height ratio you give it.
Rendered by React 19.3.1
Installation
npx shadcn@4.23.0 add https://hamur.dev/r/react/aspect-ratio.jsonIt also adds utils. The app needs its setup first: Installation.
Usage
Set ratio (16 / 9); the content fills the box.
import { AspectRatio } from '@/components/ui/aspect-ratio'Examples
API reference
Aspect Ratio wraps no headless component of its own: its parts are elements with classes, and their props are the element's.