An open API service indexing awesome lists of open source software.

https://github.com/jamiebuilds/react-prop-matrix

Render something using every possible combination of props
https://github.com/jamiebuilds/react-prop-matrix

demo docs examples react

Last synced: 3 months ago
JSON representation

Render something using every possible combination of props

Awesome Lists containing this project

README

        

# react-prop-matrix

> Render something using every possible combination of props

## Install

```sh
yarn add react-prop-matrix
```

## Example

```js
import PropMatrix from 'react-prop-matrix';

let options = {
background: ['red', 'green', 'blue'],
children: ['Hello', 'World'],
};

{props => }

```

Will generate:

```js





```

##### With Filters

```js
import PropMatrix from 'react-prop-matrix';

let options = {
background: ['red', 'green', 'blue'],
children: ['Hello', 'World'],
};

let filters = {
background: ['red', 'green'],
children: ['Hello'],
};

{props => }

```

Will generate:

```js


```

## API

### ``

#### `props.options`

An object of props containing arrays with possible values.

```js

```

#### `props.filters`

Optionally filter the generated matrix to only include items that have matching
props. An empty array will match all items.

```js

```

#### `props.children`

A function that gets called for each item in the generated matrix and returns
React elements.

```js
(

)}/>
```

> **Note:** If you want to pass an array as a prop, you still need to nest it
> inside an options array. `{ items: [[1, 2], [3, 4]] }`