1.0.1 • Published 3 years ago

react-fixed-aspect-ratio-box v1.0.1

Weekly downloads
5
License
MIT
Repository
-
Last release
3 years ago

react-fixed-aspect-ratio-box

A container that adapts the width or height of its child to preserve its specified aspect ratio.

NPM

Example

https://davidedefeudis.github.io/react-fixed-aspect-ratio-box/

Install

npm i react-fixed-aspect-ratio-box

Usage

import React from 'react'
import FixedAspectRatioBox from 'react-fixed-aspect-ratio-box'
import 'react-fixed-aspect-ratio-box/dist/index.css'

function App() {
  return (
    <FixedAspectRatioBox targetAspectRatio={16 / 9}>
      <div className='child'></div>
    </FixedAspectRatioBox>
  )
}

Props

PropTypeDescription
targetAspectRationumberThe aspect ratio that must be preserved by the child.

License

MIT © Davide De Feudis

1.0.1

3 years ago

1.0.0

3 years ago