# react-fixed-aspect-ratio-box

> Made with create-react-library

Latest version **1.0.1** (published 2021-03-14) · MIT license · 0 weekly downloads

## Install

```sh
npm install react-fixed-aspect-ratio-box
pnpm add react-fixed-aspect-ratio-box
yarn add react-fixed-aspect-ratio-box
bun add react-fixed-aspect-ratio-box
```

## Health

**Score 20/100 (F)** — status: abandoned.

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.1 |
| Published | 2021-03-14 |
| First published | 2021-02-08 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Node | >=10 |
| Dependencies | 0 |
| Unpacked size | 240.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Davide De Feudis |
| Maintainers | davidedefeudis |
| Keywords | react, box, container, responsive, layout, fixed aspect ratio |

## Links

- npm: https://www.npmjs.com/package/react-fixed-aspect-ratio-box
- Repository: Davide De Feudis/react-fixed-aspect-ratio-box
- Homepage: https://davidedefeudis.github.io/react-fixed-aspect-ratio-box/
- npm.io page: https://npm.io/package/react-fixed-aspect-ratio-box

## Alternatives

- [mobx-react](https://npm.io/package/mobx-react.md) — 2.8M weekly downloads
- [rc-tree](https://npm.io/package/rc-tree.md) — 2.6M weekly downloads
- [@react-oauth/google](https://npm.io/package/@react-oauth/google.md) — 1.3M weekly downloads
- [@wagmi/connectors](https://npm.io/package/@wagmi/connectors.md) — 877.0K weekly downloads
- [vee-validate](https://npm.io/package/vee-validate.md) — 836.4K weekly downloads

## Recent versions

- 1.0.1 (latest) — 2021-03-14
- 1.0.0 — 2021-02-08

## README

# react-fixed-aspect-ratio-box

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

[![NPM](https://img.shields.io/npm/v/react-fixed-aspect-ratio-box.svg)](https://www.npmjs.com/package/react-fixed-aspect-ratio-box)

## Example

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

## Install

```bash
npm i react-fixed-aspect-ratio-box
```

## Usage

```jsx
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

| Prop              | Type   | Description                                           |
| ----------------- | ------ | ----------------------------------------------------- |
| targetAspectRatio | number | The aspect ratio that must be preserved by the child. |

## License

MIT © [Davide De Feudis](https://github.com/DavideDeFeudis)

---
_Source: https://npm.io/package/react-fixed-aspect-ratio-box · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
