react-colrow
Smarter layout components. Based on css flexbox. Support responsive design, Typescript, server side render. 3 KB gzipped.
更智能的布局组件. 基于css flexbox. 支持响应式布局, Typescript, 服务端渲染. 3 KB gzipped.
- Typedoc Types document generated according to Typescript.
- Demo A full project demo in codesandbox. It can run online.
Col's width can be fixed number, percentage or auto grow. Support responsive layout. Row has gutter to set column spacing. This libarary based on css flexbox, not js. So it support ssr(server side render).
I created vue-colrow first. react-colrow is developed with Typescript, so I don’t want to write a repeat detailed document. If you want know more, you can refer to vue-colrow's documentation.
Usage
// change default global configconfigDEFAULT_GUTTER_X = 16configDEFAULT_GUTTER_Y = 16
<!-- break row manually -->
css is included in js. Row, Col and BreakRow are components, config
is global config.
Col's prop width can pass in number, number greater than 1 is considered to be pixels of the specified length, number less than or equal to 1 is considered to be percentage, so 1 represents 100%. Its default is 1, representing full row width. You can pass in a non-number, this will directly pass to the css width, but in this case you need to adjust it yourself, this project does not deal with it. Check documentation to learn more props.
Demo
Follow screenshot images are from vue-colrow, but it also works with react-colrow.
In small screen:
The code should be:
First Name Last Name Email Website Title About
Demo 2: Responsive card list with gutter
...