# rc-resize-observer

> Resize observer for React

Latest version **1.4.3** (published 2024-12-19) · MIT license · 0 weekly downloads

## Install

```sh
npm install rc-resize-observer
pnpm add rc-resize-observer
yarn add rc-resize-observer
bun add rc-resize-observer
```

## Health

**Score 50/100 (C)** — status: stable.

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

Warnings: low downloads.

Negative: stale.

## Facts

| | |
|---|---|
| Version | 1.4.3 |
| Published | 2024-12-19 |
| First published | 2019-09-29 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 4 |
| Unpacked size | 35.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 201 |
| Maintainers | afc163, zombiej |
| Keywords | react, react-component, react-resize-observer, resize-observer |

## Links

- npm: https://www.npmjs.com/package/rc-resize-observer
- Repository: https://github.com/react-component/resize-observer
- Homepage: https://react-component.github.io/resize-observer
- Issues: http://github.com/react-component/resize-observer/issues
- npm.io page: https://npm.io/package/rc-resize-observer

## Dependencies (4)

- [rc-util](https://npm.io/package/rc-util.md) ^5.44.1
- [classnames](https://npm.io/package/classnames.md) ^2.2.1
- [@babel/runtime](https://npm.io/package/@babel/runtime.md) ^7.20.7
- [resize-observer-polyfill](https://npm.io/package/resize-observer-polyfill.md) ^1.5.1

## 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.4.3 (latest) — 2024-12-19
- 1.4.2 — 2024-12-19
- 1.4.1 — 2024-12-11
- 1.4.0 — 2023-10-20
- 1.3.1 — 2023-02-13
- 1.3.0 — 2023-02-03
- 1.2.1 — 2022-12-27
- 1.2.0 — 2022-01-11
- 1.1.2 — 2021-12-15
- 1.1.1 — 2021-12-01
- 1.1.0 — 2021-11-29
- 1.0.1 — 2021-09-02
- 1.0.0 — 2020-12-25
- 0.3.0 — 2020-12-09
- 0.2.6 — 2020-10-21
- … 10 more at https://npm.io/package/rc-resize-observer/versions

## README

# rc-resize-observer

[![NPM version][npm-image]][npm-url] [![dumi](https://img.shields.io/badge/docs%20by-dumi-blue?style=flat-square)](https://github.com/umijs/dumi) [![build status][github-actions-image]][github-actions-url] [![Codecov][codecov-image]][codecov-url] [![npm download][download-image]][download-url]

[npm-image]: http://img.shields.io/npm/v/rc-resize-observer.svg?style=flat-square
[npm-url]: http://npmjs.org/package/rc-resize-observer
[github-actions-image]: https://github.com/react-component/resize-observer/workflows/CI/badge.svg
[github-actions-url]: https://github.com/react-component/resize-observer/actions
[codecov-image]: https://img.shields.io/codecov/c/github/react-component/resize-observer/master.svg?style=flat-square
[codecov-url]: https://codecov.io/gh/react-component/resize-observer/branch/master
[download-image]: https://img.shields.io/npm/dm/rc-resize-observer.svg?style=flat-square
[download-url]: https://npmjs.org/package/rc-resize-observer

Resize observer for React.

## Live Demo

https://react-component.github.io/resize-observer/

## Install

[![rc-resize-observer](https://nodei.co/npm/rc-resize-observer.png)](https://npmjs.org/package/rc-resize-observer)

## Usage

```js
import ResizeObserver from 'rc-resize-observer';
import { render } from 'react-dom';

render(
  <ResizeObserver
    onResize={() => {
      console.log('resized!');
    }}
  >
    <textarea />
  </ResizeObserver>,
  mountNode,
);
```

## API

| Property | Type                        | Default | Description                     |
| -------- | --------------------------- | ------- | ------------------------------- |
| disabled | boolean                     | false   |                                 |
| onResize | ({ width, height }) => void | -       | Trigger when child node resized |

## Development

```
npm install
npm start
```

## License

rc-resize-observer is released under the MIT license.

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