An open API service indexing awesome lists of open source software.

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

👓 Resize observer for React
https://github.com/react-component/resize-observer

ant-design antd react react-component

Last synced: 4 months ago
JSON representation

👓 Resize observer for React

Awesome Lists containing this project

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://resize-observer-react-component.vercel.app/

## 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(
{
console.log('resized!');
}}
>

,
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.