Docs
Aspect Ratio
Aspect Ratio
Displays content within a desired ratio.
Installation
npx shadcn-svelte add aspect-ratio
npx shadcn-svelte add aspect-ratio
Usage
<script lang="ts">
import { AspectRatio } from "$components/ui/aspect-ratio";
</script>
<script lang="ts">
import { AspectRatio } from "$components/ui/aspect-ratio";
</script>
<AspectRatio ratio={16 / 9} class="bg-muted">
<img src="..." alt="..." class="rounded-md object-cover" />
</AspectRatio>
<AspectRatio ratio={16 / 9} class="bg-muted">
<img src="..." alt="..." class="rounded-md object-cover" />
</AspectRatio>
On This Page