# react-fitty

> ![React Fitty Example](https://raw.githubusercontent.com/morhogg/react-fitty/main/assets/fitty.gif)

Latest version **1.0.1** (published 2021-01-30) · MIT license · 0 weekly downloads

## Install

```sh
npm install react-fitty
pnpm add react-fitty
yarn add react-fitty
bun add react-fitty
```

## Health

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

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.1 |
| Published | 2021-01-30 |
| First published | 2018-10-29 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Node | >=10 |
| Dependencies | 1 |
| Unpacked size | 19.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 14 |
| Author | lucasljj@gmail.com |
| Maintainers | morhogg |
| Keywords | fitty, react, react-fitty |

## Links

- npm: https://www.npmjs.com/package/react-fitty
- Repository: https://github.com/morhogg/react-fitty
- Homepage: https://github.com/morhogg/react-fitty#readme
- Issues: https://github.com/morhogg/react-fitty/issues
- npm.io page: https://npm.io/package/react-fitty

## Dependencies (1)

- [fitty](https://npm.io/package/fitty.md) 2

## 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-01-30
- 1.0.0 — 2021-01-20
- 0.0.1 — 2018-10-29

## README

# React Fitty
![React Fitty Example](https://raw.githubusercontent.com/morhogg/react-fitty/main/assets/fitty.gif)

Scales up (or down) text so it fits perfectly to its parent container.

1.5 KB

Ideal for flexible and responsive websites.

# Usage
```javascript
import { ReactFitty } from "react-fitty";

const MyComponent = () => (
    <div>
        <ReactFitty>Text Text Text Text</ReactFitty>
    </div>
)
```
### with Material-UI
```javascript
import { ReactFitty } from "react-fitty";
import { Typography } from "@material-ui/core"

const MyComponent = () => (
    <div>
        <Typography component={ReactFitty}>Text Text Text</Typography>
    </div>
)
```

### with Styled-Components
```javascript
import { ReactFitty } from "react-fitty";
import styled from "styled-components";

const TextStyled = styled(ReactFitty)`
    color: red;
    text-decoration: underline;
`;

const MyComponent = () => (
    <div>
        <TextStyled>Text Text Text</TextStyled>
    </div>
)
```

## Props
| Prop | Type | Optional | Description
| :---: | :---: | :---: | :---: |
| minSize | number | ✓ | Min text size in pixels, default: 16
| maxSize | number | ✓ | Max text size in pixels, max: 512
| wrapText | boolean | ✓ | Wrap lines when using minimum font size., default: false
| observeMutations | Object | ✓ | The object be will merged with the default react-fitty MutationObserver internal config [https://javascript.info/mutation-observer](https://javascript.info/mutation-observer)

## Development Commands

#### Run tests in a real browser
```bash
yarn ci
```

## Acknowledgements
[@rikschennink](https://github.com/rikschennink) for having created [fitty](https://github.com/rikschennink/fitty).

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