{"id":13906774,"url":"https://github.com/VAGAScom/react-describe","last_synced_at":"2025-07-18T04:32:43.503Z","repository":{"id":71259398,"uuid":"198490477","full_name":"VAGAScom/react-describe","owner":"VAGAScom","description":"An accessible React playground on top of react-docgen","archived":true,"fork":false,"pushed_at":"2019-08-06T22:17:58.000Z","size":192,"stargazers_count":10,"open_issues_count":1,"forks_count":2,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-04-10T08:36:50.088Z","etag":null,"topics":["accessibility","editor","javascript","library","playground","react"],"latest_commit_sha":null,"homepage":"https://cw9b8.codesandbox.io/","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/VAGAScom.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-07-23T18:52:42.000Z","updated_at":"2024-08-07T00:29:13.336Z","dependencies_parsed_at":"2023-07-21T21:32:41.212Z","dependency_job_id":null,"html_url":"https://github.com/VAGAScom/react-describe","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/VAGAScom%2Freact-describe","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/VAGAScom%2Freact-describe/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/VAGAScom%2Freact-describe/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/VAGAScom%2Freact-describe/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/VAGAScom","download_url":"https://codeload.github.com/VAGAScom/react-describe/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":226353442,"owners_count":17611706,"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":["accessibility","editor","javascript","library","playground","react"],"created_at":"2024-08-06T23:01:42.271Z","updated_at":"2024-11-25T15:30:41.991Z","avatar_url":"https://github.com/VAGAScom.png","language":"JavaScript","funding_links":[],"categories":["JavaScript"],"sub_categories":[],"readme":"# React Describe\n\n`React Describe` generates a component playground with editable prop values and a live preview that you can include in your own docs.\n\n\u003cimg src=\"docs/assets/code.png\" alt=\"Code example\" width=\"500\"\u003e\n\n\u003cimg src=\"docs/assets/playground.png\" alt=\"Playground example\" width=\"500\"\u003e\n\n| Table of Contents                       |\n| :-------------------------------------- |\n| [Runnable examples](#runnable-examples) |\n| [Installation](#installation)           |\n| [Usage](#usage)                         |\n| [Licensing](#licensing)                 |\n\n## Runnable examples\n\n- [Basic](https://codesandbox.io/s/react-describe-example-cw9b8)\n- [Gatsby](https://codesandbox.io/s/react-describe-gatsby-example-6x1qw)\n\n## Installation\n\nwith Yarn:\n\n```bash\nyarn add react-describe\n```\n\nwith npm:\n\n```bash\nnpm install react-describe\n```\n\n## Usage\n\n- Define `propTypes` and `defaultProps` for your component props\n- Add a comment above each prop to describe it\n\n```js\nimport React from \"react\";\nimport PropTypes from \"prop-types\";\n\n/**\n * Button description...\n */\nexport default function Button({ label, disabled, size, borderRadius }) {\n  const sizes = {\n    small: 32,\n    medium: 48,\n    large: 64\n  };\n\n  return (\n    \u003cbutton\n      style={{\n        paddingLeft: sizes[size],\n        paddingRight: sizes[size],\n        fontSize: sizes[size] / 2,\n        height: sizes[size],\n        backgroundColor: \"rebeccapurple\",\n        color: \"#fff\",\n        border: \"none\",\n        borderRadius,\n        opacity: disabled ? 0.5 : 1\n      }}\n      disabled={disabled}\n    \u003e\n      {label}\n    \u003c/button\u003e\n  );\n}\n\nButton.defaultProps = {\n  size: \"medium\",\n  disabled: false,\n  borderRadius: 0\n};\n\nButton.propTypes = {\n  /**\n   * label description...\n   */\n  label: PropTypes.string.isRequired,\n\n  /**\n   * disabled description...\n   */\n  disabled: PropTypes.bool,\n\n  /**\n   * size description...\n   */\n  size: PropTypes.oneOf([\"small\", \"medium\", \"large\"]),\n\n  /**\n   * borderRadius description...\n   */\n  borderRadius: PropTypes.number\n};\n```\n\n- Import `react-describe`\n- Import your component and place it as child of `Describe`\n- Import your component as a string and pass it to `src`\n\n```js\nimport React from \"react\";\nimport ReactDOM from \"react-dom\";\nimport { Describe } from \"react-describe\";\nimport Button from \"./Button\";\nimport RawButton from \"!raw-loader!./Button.js\";\n\nfunction App() {\n  return (\n    \u003cdiv className=\"App\"\u003e\n      \u003cDescribe src={RawButton}\u003e{state =\u003e \u003cButton {...state} /\u003e}\u003c/Describe\u003e\n    \u003c/div\u003e\n  );\n}\n\nconst rootElement = document.getElementById(\"root\");\nReactDOM.render(\u003cApp /\u003e, rootElement);\n```\n\n- You can provide an initial state to override default prop values\n\n```js\n\u003cDescribe\n  src={RawButton}\n  initialState={{\n    label: \"Button\",\n    disabled: true,\n    size: \"small\",\n    borderRadius: 3\n  }}\n\u003e\n  {state =\u003e \u003cButton {...state} /\u003e}\n\u003c/Describe\u003e\n```\n\n### Available playground inputs\n\n| PropType | input              |\n| :------- | ------------------ |\n| string   | text input         |\n| number   | number input       |\n| bool     | checkbox           |\n| oneOf    | radio-button group |\n\n## Licensing\n\nReact Describe is licensed under the [MIT License](LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FVAGAScom%2Freact-describe","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FVAGAScom%2Freact-describe","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FVAGAScom%2Freact-describe/lists"}