@@ -12,18 +12,26 @@ See the example and associated code in [TestLayout](/test/TestLayout.jsx) and
1212Make sure you use the associated styles in [ /css/styles.css] ( /css/styles.css ) , as without them, you will have
1313problems with handle placement and visibility.
1414
15- You can pass options directly to the underlying ` Draggable ` instance by using the prop ` draggableOpts ` .
15+ You can pass options directly to the underlying ` DraggableCore ` instance by using the prop ` draggableOpts ` .
1616See the [ demo] ( /test/TestLayout.jsx ) for more on this.
1717
18+ ### Installation
19+
20+ Using [ npm] ( https://www.npmjs.com/ ) :
21+
22+ $ npm install --save react-resizable
1823
1924### Usage
2025
21- ``` javascript
22- var Resizable = require (' react-resizable' ).Resizable ; // or,
23- var ResizableBox = require (' react-resizable' ).ResizableBox ;
26+ ``` js
27+ const Resizable = require (' react-resizable' ).Resizable ; // or,
28+ const ResizableBox = require (' react-resizable' ).ResizableBox ;
29+
30+ // ES6
31+ import { Resizable , ResizableBox } from ' react-resizable' ;
2432
25- ...
26- render : function () {
33+ // ...
34+ render () {
2735 return (
2836 < ResizableBox width= {200 } height= {200 } draggableOpts= {{... }}
2937 minConstraints= {[100 , 100 ]} maxConstraints= {[300 , 300 ]}>
@@ -33,37 +41,24 @@ render: function() {
3341}
3442```
3543
36- ### ` <Resizable> ` Options
44+ ### Props
3745
38- ``` js
39- {
40- // Functions
41- onResizeStop: React .PropTypes .func ,
42- onResizeStart: React .PropTypes .func ,
43- onResize: React .PropTypes .func ,
44-
45- width: React .PropTypes .number .isRequired ,
46- height: React .PropTypes .number .isRequired ,
47- // If you change this, be sure to update your css
48- handleSize: React .PropTypes .array ,
49- // These will be passed wholesale to react-draggable
50- draggableOpts: React .PropTypes .object
51- }
52- ```
53-
54- ### ` <ResizableBox> ` Options
46+ These props apply to both ` <Resizable> ` and ` <ResizableBox> ` .
5547
5648``` js
5749{
58- lockAspectRatio: React .PropTypes .bool , // Preserves aspect
59-
60- // Constaints coords, pass [x,y]
61- minConstraints: React .PropTypes .arrayOf (React .PropTypes .number ),
62- maxConstraints: React .PropTypes .arrayOf (React .PropTypes .number ),
63-
64- // Initial width/height - otherwise use CSS
65- height: React .PropTypes .number ,
66- width: React .PropTypes .number
67- }
68- ```
50+ children: React .Element < any> ,
51+ width: number,
52+ height: number,
53+ // If you change this, be sure to update your css
54+ handleSize: [number, number] = [10 , 10 ],
55+ lockAspectRatio: boolean = false ,
56+ axis: ' both' | ' x' | ' y' | ' none' = ' both' ,
57+ minConstraints: [number, number] = [10 , 10 ],
58+ maxConstraints: [number, number] = [Infinity , Infinity ],
59+ onResizeStop?: ? (e : SyntheticEvent , data : ResizeCallbackData ) => any,
60+ onResizeStart?: ? (e : SyntheticEvent , data : ResizeCallbackData ) => any,
61+ onResize?: ? (e : SyntheticEvent , data : ResizeCallbackData ) => any,
62+ draggableOpts?: ? Object
63+ };
6964` ` `
0 commit comments