Make PropsTable capable of accepting manual prop entries
See original GitHub issueReact Docgen is… imperfect.
But the PropsTable looks great. I’d love to manually maintain a props listing for the docs using PropsTable like this:
<PropsTable
props={[
{property: 'variant', type: 'enum', required: false, default: 'primary', description: 'Can also specify "secondary"'},
// ... etc.
]}
/>
Thoughts?
Issue Analytics
- State:
- Created 5 years ago
- Reactions:21
- Comments:9 (1 by maintainers)
Top Results From Across the Web
Make PropsTable capable of accepting manual prop entries · Issue ...
I'm currently working on a project that doesn't use prop-types and is not statically typed either . Having the ability to manually add...
Read more >pedronauck/docz (Raised $598.00) - Issuehunt
Funded#480created bycryzzchen. $37.00. Make PropsTable capable of accepting manual prop entries. Funded#360created bykentcdodds. $12.00. Recent activities.
Read more >How passing props to component works in React
Master how to pass props (properties) to components in React with this useful beginner's guide, including demo code.
Read more >10 Testing and Profiling Java Application Projects
To create a JUnit JDBC test fixture class: In the Applications window, select the project. Choose File > New > From Gallery.
Read more >Glossary of Technical Theatre Terms - Stage Management
The ASM is reponsible for setting props used during the show, as well as carrying out a pre-show check list to ensure all...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Here is the solution (called
SimplePropsTable
): https://gist.github.com/dfee/856f78ad4182d079dafbba6c63992005Practically speaking, it implements an interface that
PropsTable
could (should) take advantage of – so one day this could be built-in.I love the idea, @kentcdodds!
I’m currently working on a project that doesn’t use
prop-types
and is not statically typed either 😬. Having the ability to manually add prop definitions is definitely a great addition to Docz!I started working on this idea, and made some very good progress!
Here are the results of what I have so far…
Given this markup:
The following is rendered:
It’s worth mentioning that Docz has some expectations around the component’s docgen info, so I started experimenting with some schema validation mechanism that I think would go hand in hand with this feature. This will:
props
doesn’t match what Docz expects (a valid react-docgen data structure, that is).For example, when defining a prop of type
enum
, its value should be an array of objects that have a keyvalue
, like in the example above. The following will not be considered valid:In case it was entered, an error like this will be thrown :
Another example:
There’s still a lot of work to be done here, but I thought I’d share my proof of concept as well! 😅