Docs
Aspect Ratio

Aspect Ratio

Displays content within a desired ratio.

Loading...

Installation

	npx svell@latest add aspect-ratio

Usage

	<script lang="ts">
  import { AspectRatio } from "$lib/components/ui/aspect-ratio";
</script>
 
<div class="w-[450px]">
  <AspectRatio ratio={16 / 9} class="bg-muted">
    <img src="..." alt="..." class="rounded-md object-cover" />
  </AspectRatio>
</div>

Built & designed by shadcn. Ported to Svelte by netronk. The source code is available on GitHub.