1.1.2 • Published 5 years ago

react-balanced-columns v1.1.2

Weekly downloads
-
License
ISC
Repository
-
Last release
5 years ago

React Balanced Columns

Setup

Description

This component divides a list up into columns that "balance" themselves dynamically when both a max number of columns and min length to fill a column is specified.

Installation

Install using the package manager of your choice:

npm install react-balanced-columns or yarn add react-balanced-columns

then include the component in your project:

import { BalancedColumns } from 'react-balanced-columns'

Props

PropNameIsRequiredTypeDescription
childrentrueArray[React.Children](https://reactjs.org/docs/react-api.html#reactchildren)This component accepts an array of react children that will be balanced across the rendered columns.
minRowBreakpointtruenumberThe minimum number of rows that must be filled before proceeding to fill the next column. Note: given is a minimum each column may be longer than this length.
maxColumnstruenumberThe maximum number of columns allowed. Note: given this is a maximum, there may be fewer columns than this number.
columnWidthfalsenumberAn optional field whose units are in pixels. It allows an exact width to be specified. The default is flex-basis auto, which will grow to accommodate width of the children.

Examples

Below are some examples of how changing each of the props changes the end result.

Changing number of children

Changing maxColumns

Changing minRowBreakpoint

Contributing

Clone the project and run npm install. npm run storybook will spawn a staging ground to demo any changes to the component. Eslint and prettier are used for code formatting. TypeScript is used for the type-system and for transpilation to an es5 dist.