AspectRatio

Keeps its content at a fixed width-to-height ratio.

Import

import { AspectRatio } from "@tarve/core";

Usage

AspectRatio.tsx
import { AspectRatio, Image } from "@tarve/core";

<AspectRatio ratio={16 / 9} width={480}>
  <Image src="assets/cover.png" fit="cover" />
</AspectRatio>

Props

PropTypeDefault
ratio required number—
width Style["width"]320

Common props

Shared by every component. See descriptions →

childrenhighlightidkeymotionFromonHighlightonPasteonTransitionEndrovingGroupstyle