{"id":17767351,"url":"https://github.com/jamiebuilds/react-prop-matrix","last_synced_at":"2025-07-29T00:37:17.133Z","repository":{"id":57342793,"uuid":"145622193","full_name":"jamiebuilds/react-prop-matrix","owner":"jamiebuilds","description":"Render something using every possible combination of props","archived":false,"fork":false,"pushed_at":"2018-08-24T21:41:47.000Z","size":39,"stargazers_count":66,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-12T21:02:50.741Z","etag":null,"topics":["demo","docs","examples","react"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jamiebuilds.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-08-21T21:37:21.000Z","updated_at":"2024-09-24T18:27:22.000Z","dependencies_parsed_at":"2022-09-16T03:02:13.235Z","dependency_job_id":null,"html_url":"https://github.com/jamiebuilds/react-prop-matrix","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jamiebuilds%2Freact-prop-matrix","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jamiebuilds%2Freact-prop-matrix/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jamiebuilds%2Freact-prop-matrix/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jamiebuilds%2Freact-prop-matrix/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jamiebuilds","download_url":"https://codeload.github.com/jamiebuilds/react-prop-matrix/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243735851,"owners_count":20339538,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["demo","docs","examples","react"],"created_at":"2024-10-26T20:46:22.858Z","updated_at":"2025-03-15T13:31:18.801Z","avatar_url":"https://github.com/jamiebuilds.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# react-prop-matrix\n\n\u003e Render something using every possible combination of props\n\n## Install\n\n```sh\nyarn add react-prop-matrix\n```\n\n## Example\n\n```js\nimport PropMatrix from 'react-prop-matrix';\n\nlet options = {\n  background: ['red', 'green', 'blue'],\n  children: ['Hello', 'World'],\n};\n\n\u003cPropMatrix options={options}\u003e\n  {props =\u003e \u003cButton {...props}\u003e}\n\u003c/PropMatrix\u003e\n```\n\nWill generate:\n\n```js\n\u003cReact.Fragment\u003e\n  \u003cButton background=\"red\" children=\"Hello\"/\u003e\n  \u003cButton background=\"green\" children=\"Hello\"/\u003e\n  \u003cButton background=\"blue\" children=\"Hello\"/\u003e\n\n  \u003cButton background=\"red\" children=\"World\"/\u003e\n  \u003cButton background=\"green\" children=\"World\"/\u003e\n  \u003cButton background=\"blue\" children=\"World\"/\u003e\n\u003c/React.Fragment\u003e\n```\n\n##### With Filters\n\n```js\nimport PropMatrix from 'react-prop-matrix';\n\nlet options = {\n  background: ['red', 'green', 'blue'],\n  children: ['Hello', 'World'],\n};\n\nlet filters = {\n  background: ['red', 'green'],\n  children: ['Hello'],\n};\n\n\u003cMatrix filters={filters} options={options}\u003e\n  {props =\u003e \u003cButton {...props}\u003e}\n\u003c/Matrix\u003e\n```\n\nWill generate:\n\n```js\n\u003cReact.Fragment\u003e\n  \u003cButton background=\"red\" children=\"Hello\"/\u003e\n  \u003cButton background=\"green\" children=\"Hello\"/\u003e\n\u003c/React.Fragment\u003e\n```\n\n## API\n\n### `\u003cPropMatrix/\u003e`\n\n#### `props.options`\n\nAn object of props containing arrays with possible values.\n\n```js\n\u003cPropMatrix\n  options={{\n    background: ['red', 'blue', 'green'],\n    children: ['Hello', 'World'],\n  }}/\u003e\n```\n\n#### `props.filters`\n\nOptionally filter the generated matrix to only include items that have matching\nprops. An empty array will match all items.\n\n```js\n\u003cPropMatrix\n  filters={{\n    background: ['red', 'blue'],\n    children: ['Hello'],\n  }}/\u003e\n```\n\n#### `props.children`\n\nA function that gets called for each item in the generated matrix and returns\nReact elements.\n\n```js\n\u003cPropMatrix\n  children={props =\u003e (\n    \u003cComponent {...props}/\u003e\n  )}/\u003e\n```\n\n\u003e **Note:** If you want to pass an array as a prop, you still need to nest it\n\u003e inside an options array. `{ items: [[1, 2], [3, 4]] }`\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjamiebuilds%2Freact-prop-matrix","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjamiebuilds%2Freact-prop-matrix","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjamiebuilds%2Freact-prop-matrix/lists"}