reactjs / reactjs/react-docgen
Can I "get" the intended HTML element to be rendered?
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 3.8k
- Forks
- 316
- Avg merge
- 5h 7m
- Merged PRs (30d)
- 4
Description
I would like to document both the props and the HTML element that a react component plans on rendering:
const MyComponent = ({ foo, bar, ...restProps }) => <h1 foo={ foo } bar={bar} {...restProps } />;
MyComponent.propTypes = {
foo: PropTypes.string,
bar: PropTypes.number,
}
In the above example I want to be able to document:
- The props stated in propTypes
- The "native" HTML props that would be valid for an
h1element.
In the docs i wanna say:
"here are the explicitly set props and this component also takes all valid props for HTMLHeadingElement"
Is it possible for us to get the h1 tag from docgen so we can associate that component's documentation with its html tag?
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
No files, tests, or entry points are named; begin by locating the docgen parser or API that extracts React component metadata and its existing test coverage. Done means exposing the rendered native HTML tag alongside the documented prop information, with coverage demonstrating the h1 case.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- react, typescript
- Domain
- documentation
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100