npm.io
0.1.0 • Published 7 years ago

preact-combinations

Licence
MIT
Version
0.1.0
Deps
0
Size
7 kB
Vulns
0
Weekly
0

preact-combinations

Pass an array of value per props; get the element rendered as all possible combinations of those props.

Install

npm i preact-combinations

Use

Pass an object of props, with each prop being an arry of potential values to take.

const combinations = {
  color: ["red","green","blue"],
  elevation: [1,2,5,10],
  children: ["Button", "🌍"]
}
<Combinations component={Button} combinations={combinations}/>

Style the per-element wrapper to add gaps, etc.

const style = {
  margin: "1em .5em"
}
<Combinations component={Button} combinations={combinations} style={style}/>

Keywords