@@ -14,6 +14,7 @@ or autogenerated.
1414RGL is React-only and does not require jQuery.
1515
1616![ BitMEX UI] ( http://i.imgur.com/oo1NT6c.gif )
17+
1718> GIF from production usage on [ BitMEX.com] ( https://www.bitmex.com )
1819
1920[ ** [ Demo] ( https://react-grid-layout.github.io/react-grid-layout/ ) | [ Changelog] ( /CHANGELOG.md ) | [ CodeSandbox Editable demo] ( https://codesandbox.io/s/5wy3rz5z1x?module=%2Fsrc%2FShowcaseLayout.js ) ** ]
@@ -77,32 +78,32 @@ RGL is React-only and does not require jQuery.
7778- [ Statsout] ( https://statsout.com/ )
7879- [ Datto RMM] ( https://www.datto.com/uk/products/rmm/ )
7980
80- * Know of others? Create a PR to let me know!*
81+ _ Know of others? Create a PR to let me know!_
8182
8283## Features
8384
84- * 100% React - no jQuery
85- * Compatible with server-rendered apps
86- * Draggable widgets
87- * Resizable widgets
88- * Static widgets
89- * Configurable packing: horizontal, vertical, or off
90- * Bounds checking for dragging and resizing
91- * Widgets may be added or removed without rebuilding grid
92- * Layout can be serialized and restored
93- * Responsive breakpoints
94- * Separate layouts per responsive breakpoint
95- * Grid Items placed using CSS Transforms
96- * Performance with CSS Transforms: [ on] ( http://i.imgur.com/FTogpLp.jpg ) / [ off] ( http://i.imgur.com/gOveMm8.jpg ) , note paint (green) as % of time
97- * Compatibility with ` <React.StrictMode> `
98-
99- | Version | Compatibility |
100- | ---------------- | ------------------ |
101- | >= 0.17.0 | React 16 & 17 |
102- | >= 0.11.3 | React 0.14 & 15 |
103- | >= 0.10.0 | React 0.14 |
104- | 0.8. - 0.9.2 | React 0.13 |
105- | < 0.8 | React 0.12 |
85+ - 100% React - no jQuery
86+ - Compatible with server-rendered apps
87+ - Draggable widgets
88+ - Resizable widgets
89+ - Static widgets
90+ - Configurable packing: horizontal, vertical, or off
91+ - Bounds checking for dragging and resizing
92+ - Widgets may be added or removed without rebuilding grid
93+ - Layout can be serialized and restored
94+ - Responsive breakpoints
95+ - Separate layouts per responsive breakpoint
96+ - Grid Items placed using CSS Transforms
97+ - Performance with CSS Transforms: [ on] ( http://i.imgur.com/FTogpLp.jpg ) / [ off] ( http://i.imgur.com/gOveMm8.jpg ) , note paint (green) as % of time
98+ - Compatibility with ` <React.StrictMode> `
99+
100+ | Version | Compatibility |
101+ | ------------ | --------------- |
102+ | >= 0.17.0 | React 16 & 17 |
103+ | >= 0.11.3 | React 0.14 & 15 |
104+ | >= 0.10.0 | React 0.14 |
105+ | 0.8. - 0.9.2 | React 0.13 |
106+ | < 0.8 | React 0.12 |
106107
107108## Installation
108109
@@ -129,41 +130,53 @@ produce a grid with three items where:
129130- users will be able to freely drag and resize item ` c `
130131
131132``` js
132- import GridLayout from ' react-grid-layout' ;
133+ import GridLayout from " react-grid-layout" ;
133134
134135class MyFirstGrid extends React .Component {
135136 render () {
136137 // layout is an array of objects, see the demo for more complete usage
137138 const layout = [
138- {i: ' a ' , x: 0 , y: 0 , w: 1 , h: 2 , static: true },
139- {i: ' b ' , x: 1 , y: 0 , w: 3 , h: 2 , minW: 2 , maxW: 4 },
140- {i: ' c ' , x: 4 , y: 0 , w: 1 , h: 2 }
139+ { i: " a " , x: 0 , y: 0 , w: 1 , h: 2 , static: true },
140+ { i: " b " , x: 1 , y: 0 , w: 3 , h: 2 , minW: 2 , maxW: 4 },
141+ { i: " c " , x: 4 , y: 0 , w: 1 , h: 2 }
141142 ];
142143 return (
143- < GridLayout className= " layout" layout= {layout} cols= {12 } rowHeight= {30 } width= {1200 }>
144+ < GridLayout
145+ className= " layout"
146+ layout= {layout}
147+ cols= {12 }
148+ rowHeight= {30 }
149+ width= {1200 }
150+ >
144151 < div key= " a" > a< / div>
145152 < div key= " b" > b< / div>
146153 < div key= " c" > c< / div>
147154 < / GridLayout>
148- )
155+ );
149156 }
150157}
151158```
152159
153160You may also choose to set layout properties directly on the children:
154161
155162``` js
156- import GridLayout from ' react-grid-layout' ;
163+ import GridLayout from " react-grid-layout" ;
157164
158165class MyFirstGrid extends React .Component {
159166 render () {
160167 return (
161168 < GridLayout className= " layout" cols= {12 } rowHeight= {30 } width= {1200 }>
162- < div key= " a" data- grid= {{x: 0 , y: 0 , w: 1 , h: 2 , static: true }}> a< / div>
163- < div key= " b" data- grid= {{x: 1 , y: 0 , w: 3 , h: 2 , minW: 2 , maxW: 4 }}> b< / div>
164- < div key= " c" data- grid= {{x: 4 , y: 0 , w: 1 , h: 2 }}> c< / div>
169+ < div key= " a" data- grid= {{ x: 0 , y: 0 , w: 1 , h: 2 , static: true }}>
170+ a
171+ < / div>
172+ < div key= " b" data- grid= {{ x: 1 , y: 0 , w: 3 , h: 2 , minW: 2 , maxW: 4 }}>
173+ b
174+ < / div>
175+ < div key= " c" data- grid= {{ x: 4 , y: 0 , w: 1 , h: 2 }}>
176+ c
177+ < / div>
165178 < / GridLayout>
166- )
179+ );
167180 }
168181}
169182```
@@ -178,21 +191,24 @@ excludes `React`, so it must be otherwise available in your application, either
178191To make RGL responsive, use the ` <ResponsiveReactGridLayout> ` element:
179192
180193``` js
181- import { Responsive as ResponsiveGridLayout } from ' react-grid-layout' ;
194+ import { Responsive as ResponsiveGridLayout } from " react-grid-layout" ;
182195
183196class MyResponsiveGrid extends React .Component {
184197 render () {
185198 // {lg: layout1, md: layout2, ...}
186199 const layouts = getLayoutsFromSomewhere ();
187200 return (
188- < ResponsiveGridLayout className= " layout" layouts= {layouts}
189- breakpoints= {{lg: 1200 , md: 996 , sm: 768 , xs: 480 , xxs: 0 }}
190- cols= {{lg: 12 , md: 10 , sm: 6 , xs: 4 , xxs: 2 }}>
201+ < ResponsiveGridLayout
202+ className= " layout"
203+ layouts= {layouts}
204+ breakpoints= {{ lg: 1200 , md: 996 , sm: 768 , xs: 480 , xxs: 0 }}
205+ cols= {{ lg: 12 , md: 10 , sm: 6 , xs: 4 , xxs: 2 }}
206+ >
191207 < div key= " 1" > 1 < / div>
192208 < div key= " 2" > 2 < / div>
193209 < div key= " 3" > 3 < / div>
194210 < / ResponsiveGridLayout>
195- )
211+ );
196212 }
197213}
198214```
@@ -215,7 +231,7 @@ positions on drag events. In simple cases a HOC `WidthProvider` can be used to a
215231width upon initialization and window resize events.
216232
217233``` js
218- import { Responsive , WidthProvider } from ' react-grid-layout' ;
234+ import { Responsive , WidthProvider } from " react-grid-layout" ;
219235
220236const ResponsiveGridLayout = WidthProvider (Responsive);
221237
@@ -224,14 +240,17 @@ class MyResponsiveGrid extends React.Component {
224240 // {lg: layout1, md: layout2, ...}
225241 var layouts = getLayoutsFromSomewhere ();
226242 return (
227- < ResponsiveGridLayout className= " layout" layouts= {layouts}
228- breakpoints= {{lg: 1200 , md: 996 , sm: 768 , xs: 480 , xxs: 0 }}
229- cols= {{lg: 12 , md: 10 , sm: 6 , xs: 4 , xxs: 2 }}>
243+ < ResponsiveGridLayout
244+ className= " layout"
245+ layouts= {layouts}
246+ breakpoints= {{ lg: 1200 , md: 996 , sm: 768 , xs: 480 , xxs: 0 }}
247+ cols= {{ lg: 12 , md: 10 , sm: 6 , xs: 4 , xxs: 2 }}
248+ >
230249 < div key= " 1" > 1 < / div>
231250 < div key= " 2" > 2 < / div>
232251 < div key= " 3" > 3 < / div>
233252 < / ResponsiveGridLayout>
234- )
253+ );
235254 }
236255}
237256```
@@ -494,7 +513,6 @@ will be draggable, even if the item is marked `static: true`.
494513
495514` < ReactGridLayout> ` has [an optimized ` shouldComponentUpdate` implementation](lib/ReactGridLayout.jsx), but it relies on the user memoizing the ` children` array:
496515
497-
498516` ` ` js
499517// lib/ReactGridLayout.jsx
500518// ...
@@ -517,7 +535,7 @@ If you memoize your children, you can take advantage of this, and reap faster re
517535function MyGrid (props ) {
518536 const children = React .useMemo (() => {
519537 return new Array (props .count ).fill (undefined ).map ((val , idx ) => {
520- return < div key= {idx} data- grid= {{x: idx, y: 1 , w: 1 , h: 1 }} / > ;
538+ return < div key= {idx} data- grid= {{ x: idx, y: 1 , w: 1 , h: 1 }} / > ;
521539 });
522540 }, [props .count ]);
523541 return < ReactGridLayout cols= {12 }> {children}< / ReactGridLayout> ;
@@ -540,7 +558,7 @@ const CustomGridItemComponent = React.forwardRef(({style, className, ...props},
540558 return (
541559 < div style= {{ /* styles */ , ... style}} className= {className} ref= {ref}>
542560 {/* Some other content */ }
543- < / div>
561+ < / div>
544562 );
545563}
546564` ` `
0 commit comments