Addon-docs: Support JSDoc params to describe the signature of a function in the props table
See original GitHub issueIs your feature request related to a problem? Please describe. I would like to be able to define the signature of my function in description column of the props table.
I love how it’s done in Semantic UI React documentation
This is define with JSDoc:
/**
* Called on blur.
*
* @param {SyntheticEvent} event - React's original SyntheticEvent.
* @param {object} data - All props.
*/
onBlur: PropTypes.func,
This doesn’t seem to be a native feature of react-docgen. I made a quick test on the playground and I get the following:
"bar": {
"type": {
"name": "custom",
"raw": "function(props, propName, componentName) {\n // ...\n}"
},
"required": false,
"description": "Description of prop \"bar\" (a custom validation function).\n@param {SyntheticEvent} event - Test",
"defaultValue": {
"value": "21",
"computed": false
}
},
I guess they somehow parse the JSDoc in the description prop.
Issue Analytics
- State:
- Created 4 years ago
- Comments:16 (11 by maintainers)
Top Results From Across the Web
Use JSDoc: @param
The @param tag provides the name, type, and description of a function parameter. The @param tag requires you to specify the name of...
Read more >storybook/addon-docs - npm
DocsPage is a zero-config aggregation of your component stories, text descriptions, docgen comments, props tables, and code examples into ...
Read more >ArgsTable - Storybook - JS.ORG
Storybook Docs automatically generates component args tables for components in supported frameworks. These tables list the arguments (args for short) of the ...
Read more >Documenting design systems with Storybook Docs
Storybook is a playground for UI development. It's a great tool to help designers, project managers, and developers understand and visualize ...
Read more >JSDoc Reference - TypeScript: Documentation
Note any tags which are not explicitly listed below (such as @async ) are not yet supported. Types. @type; @param (or @arg or...
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 Free
Top 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
@Losses there are two different codepaths, one for
react-docgen-typescript-loader
(the recommended 5.3 setup) and one forbabel-plugin-react-docgen
(the recommended 6.0 setup). i’m guessing @patricklafrance fixed this for the former but not the latter.More info: https://github.com/storybookjs/storybook/blob/next/MIGRATION.md#rolling-back
Still need to add the @params and @returns tags optional description under the func type.
Working on it now!