2.0.1 • Published 6 years ago

react-component-resizable v2.0.1

Weekly downloads
87
License
MIT
Repository
github
Last release
6 years ago

React Resizable Component

CircleCI

A React component to implement cross-browser event based resize detection, without interval polling!.

DEMO

Usage

var Resizable = require('react-component-resizable');
<Resizable className="via transferPropsTo" onResize={this.onResize}>
  Content...
</Resizable>

npm install react-component-resizable --save

Prop types

static propTypes = {
  triggersClass: PropTypes.string,
  expandClass  : PropTypes.string,
  contractClass: PropTypes.string,
  embedCss     : PropTypes.bool,
  onResize     : PropTypes.func.isRequired
}

static defaultProps = {
  triggersClass: 'resize-triggers',
  expandClass: 'expand-trigger',
  contractClass: 'contract-trigger',
  embedCss: true
}

Default style

The component will automatically embed some required style. This can be turned off using the embedCss={false} prop.

.resize-triggers {
  visibility: hidden;
}

.resize-triggers, .resize-triggers > div, .contract-trigger:before {
  content: " ";
  display: block;
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  width: 100%;
  overflow: hidden;
}

.resize-triggers > div {
  overflow: auto;
}

.contract-trigger:before {
  width: 200%;
  height: 200%;
}

Credits

Many thanks to Daniel - backalleycoder.com for this blog post and scecima and his project javascript-detect-element-resize!

Licence

MIT

2.0.1

6 years ago

2.0.0

7 years ago

1.1.0-rc1

8 years ago

1.0.2

8 years ago

1.1.0-beta

8 years ago

1.0.1

8 years ago

1.0.0

8 years ago

0.3.0

9 years ago

0.2.3

10 years ago

0.2.2

10 years ago

0.2.1

10 years ago

0.2.0

10 years ago

0.1.1

10 years ago

0.1.0

10 years ago