{"id":13394046,"url":"https://github.com/atlassian/extract-react-types","last_synced_at":"2025-05-05T23:34:05.931Z","repository":{"id":26497377,"uuid":"101705802","full_name":"atlassian/extract-react-types","owner":"atlassian","description":"One stop shop for documenting your react components.","archived":false,"fork":false,"pushed_at":"2024-09-30T06:58:53.000Z","size":2802,"stargazers_count":183,"open_issues_count":30,"forks_count":28,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-05-01T00:37:10.196Z","etag":null,"topics":["babel-plugin","docgen","docgenerator","docs","docs-as-code","prop-types","react-components","typescript"],"latest_commit_sha":null,"homepage":"https://atlassian.github.io/extract-react-types/","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/atlassian.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":"contributing.md","funding":null,"license":"LICENSE","code_of_conduct":"code-of-conduct.md","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":"2017-08-29T01:43:22.000Z","updated_at":"2025-01-22T10:40:19.000Z","dependencies_parsed_at":"2024-01-13T17:11:20.834Z","dependency_job_id":"a2fbab61-b16b-485e-9cfc-7331b130d966","html_url":"https://github.com/atlassian/extract-react-types","commit_stats":{"total_commits":266,"total_committers":34,"mean_commits":7.823529411764706,"dds":0.6879699248120301,"last_synced_commit":"bb6c14d0193bc091c1c58ba06667ea4a20f13f07"},"previous_names":[],"tags_count":136,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/atlassian%2Fextract-react-types","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/atlassian%2Fextract-react-types/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/atlassian%2Fextract-react-types/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/atlassian%2Fextract-react-types/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/atlassian","download_url":"https://codeload.github.com/atlassian/extract-react-types/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252594474,"owners_count":21773669,"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":["babel-plugin","docgen","docgenerator","docs","docs-as-code","prop-types","react-components","typescript"],"created_at":"2024-07-30T17:01:07.056Z","updated_at":"2025-05-05T23:34:05.906Z","avatar_url":"https://github.com/atlassian.png","language":"JavaScript","readme":"# Extract React Types\n\n\u003e One stop shop to document your react components.\n\n\u003cp align=\"center\"\u003e\n  \u003cimg width=\"500\" src=\"./assets/example.png\"\u003e\n\u003c/p\u003e\n\n## Getting started 🏁\n\n### Step 1: Install\n\n`npm install --save-dev babel-plugin-extract-react-types pretty-proptypes`\n\n### Step 2: Annotate your prop types\n\n```typescript\nexport interface AvatarPropTypes {\n  /** Provides a url for avatars being used as a link. */\n  href?: string;\n  /** Defines the size of the avatar */\n  size?: 'small' | 'medium' | 'large';\n  /** Name will be displayed in a tooltip */\n  name?: string;\n  /** A url to load an image from (this can also be a base64 encoded image). */\n  src?: string;\n  /** A `testId` prop is provided for specified elements, which is a unique string that appears as a data attribute `data-testid` in the rendered code, serving as a hook for automated tests */\n  testId?: string;\n}\n```\n\n### Step 3: Output prop types\n\npretty-proptypes can display props from two sources.\n\n**Option 1.** Using [babel-plugin-extract-react-types](./packages/babel-plugin-extract-react-types) and passing the component to Props\n\n`.babelrc`\n\n```json\n{\n  \"plugins\": [\"babel-plugin-extract-react-types\"]\n}\n```\n\n```jsx\nimport Props from 'pretty-proptypes';\nimport MyCoolComponent from '../MyCoolComponent';\n\n\u003cProps heading=\"My Cool Component\" component={MyCoolComponent} /\u003e;\n```\n\n**Option 2.** Directly passing a component's props to Props with [extract-react-types-loader](./packages/extract-react-types-loader) or getting types from [extract-react-types](./packages/extract-react-types) and writing it to a file\n\n```jsx\nimport Props from 'pretty-proptypes';\n\n\u003cProps\n  heading=\"My Cool Component\"\n  props={require('!!extract-react-types-loader!../MyCoolComponent')}\n/\u003e;\n```\n\nThis analyses prop type definitions, and default props. It creates descriptions from comments before the type definitions, and will render markdown syntax using [react-markings](https://www.npmjs.com/package/react-markings).\n\n## Packages\n\n1. [extract-react-types](./packages/extract-react-types) _Extract Flow \u0026 TypeScript types from React Components_\n2. [extract-react-types-loader](./packages/extract-react-types-loader) _Webpack loader for extract-react-types_\n3. [babel-plugin-extract-react-types](./packages/babel-plugin-extract-react-types) _A Babel plugin to store the types of React components as a property on the component for documentation_\n4. [kind2string](./packages/kind2string) _kind2string is designed to take the data structures output by extract-react-types and convert it down to a (useful) string._\n5. [pretty-proptypes](./packages/pretty-proptypes) _PrettyPropTypes is designed to display the output of extract-react-types and display rich prop information for consumers._\n\n## Contribute\n\nPull requests, issues and comments welcome - please read our [contributing guidelines](./contributing.md) and our [code of conduct](./code-of-conduct.md).\n\n[![Atlassian](https://raw.githubusercontent.com/atlassian-internal/oss-assets/master/banner-cheers-light.png)](https://atlassian.com)\n","funding_links":[],"categories":["JavaScript"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fatlassian%2Fextract-react-types","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fatlassian%2Fextract-react-types","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fatlassian%2Fextract-react-types/lists"}