TidalUI

Aspect ratio preview

Reserve media space at a chosen width-to-height ratio before content loads.

free · Essentials · primitive

When to use

Alternatives

Configure components.json and the @tidal-pro namespace before installing Pro components.

Installation

npx shadcn@latest add https://tidalui.com/r/aspect-ratio.json

Import components/ui/tidal.css, components/ui/aspect-ratio.css. Wrap installed components in tidal-scope.

Preview

Aspect ratio component preview

Open interactive preview

Minimal example

import"./components/ui/tidal.css";
import"./components/ui/aspect-ratio.css";
import{TidalAspectRatio}from"./components/ui/aspect-ratio";
export default()=><div className="tidal-scope"><TidalAspectRatio/></div>;

API and props

TidalAspectRatio.clip
boolean | undefined

Crop overflowing media. Leave false when content needs a visible focus ring.

TidalAspectRatio.ratio
number | undefined

Width divided by height. Invalid or nonpositive values use 16 / 9.

Complete usage

Full example, stylesheet imports, API and accessibility documentation

Gotchas