Skip to content

Early previewhamur is not on npm yet. The components are being built in the open, follow along on GitHub.

UIComponentsReact

Aspect Ratio

A box that keeps the width to height ratio you give it.

Rendered by React 19.3.1

aspect-ratio.tsx

Installation

npx shadcn@4.23.0 add https://hamur.dev/r/react/aspect-ratio.json

It 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.