Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat: Aspect Ratio #3

Closed
k11q opened this issue Jun 23, 2023 · 0 comments
Closed

Feat: Aspect Ratio #3

k11q opened this issue Jun 23, 2023 · 0 comments
Assignees

Comments

@k11q
Copy link
Member

k11q commented Jun 23, 2023

reference

Root

Contains the content you want to constrain to a given ratio.

Name Required Type Default Description Status
asChild false boolean false Change the default rendered element for the one passed as a child, merging their props and behavior.

Read our Composition guide for more details.
⚠️
ratio false number 1 The desired ratio

Examples

Working Demo

<script setup lang="ts">
import { AspectRatio } from "radix-vue";
</script>

<template>
  <div class="shadow-blackA7 w-[300px] overflow-hidden rounded-md shadow-[0_2px_10px]">
    <AspectRatio :ratio="16 / 9">
      <img class="h-full w-full object-cover"
        src="https://images.unsplash.com/photo-1535025183041-0991a977e25b?w=300&dpr=2&q=80"
        alt="Landscape photograph by Tobias Tullius" />
    </AspectRatio>
  </div>
</template>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
Status: Final: Complete Docs
Development

No branches or pull requests

1 participant