-
-
Notifications
You must be signed in to change notification settings - Fork 9.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Docs Generation - No inputs found for this component | Typescript | React #13304
Comments
Can you remove |
@shilman I'm experiencing similar issue where Storybook doesn't generate Docs for a component story. I have a simple example repo based on the latest Storybook packages (installed with I did run
Example repo: https://github.com/pauliusef/sb-ts-doc-test |
I think this could probably be raised as an issue with |
One thing we found recently when we had some stories documenting props and some not was that those those that were working were using components that were exported when they were declared and those that didn't did not include this. e.g After adding export to the beginning of all of our components, all stories began documenting as expected. |
That was exactly my problem! That should be fixed, right? |
I have components that are exported later as a default that do work and others written the same way that don't |
Thank you @CraigCowling79! Took me forever to figure that out. Would be cool if we could write components as
and still have the controls inferred Edit: Looks like the props are inferred even when using the default export, but the named export still has to be there. |
I'm finding that docs will generate for this: Works: import React from 'react';
export const Button = (props: ButtonOwnProps) => <div />;
export interface ButtonOwnProps {
/**
* Some prop
*/
someProp?: boolean;
}
export default Button; But docs gen will fail if I add a type declaration ( Doesn't work: import React from 'react';
export const Button: React.FC<ButtonOwnProps> = (props: ButtonOwnProps) => <div />;
export interface ButtonOwnProps {
/**
* Some prop
*/
someProp?: boolean;
}
export default Button; This can be resolved by replacing Works: import * as React from 'react';
export const Button: React.FC<ButtonOwnProps> = (props: ButtonOwnProps) => <div />;
export interface ButtonOwnProps {
/**
* Some prop
*/
someProp?: boolean;
}
export default Button; Also worth noting this is hard to recreate as the docs gen seems to cache information, so you have to restart storybook to be sure of what the breaking changes are! |
Thanks @penx -- very interesting. We rely on a dependency called |
It seems that react-docgen-typescript is not respecting
https://www.typescriptlang.org/tsconfig#Interop_Constraints_6252 Related: |
Using the latest version: 6.4.19 Can it be that subcomponents are not inferred at all?
If I put Row or Cell as Also I noticed that |
We may have incurred in the same issue in WordPress/gutenberg#39468 (comment) |
same issue too |
We have this issue in components with generics. The args table is restored if we force the typecast in this way (last row):
|
Same issue here; workarounds aren't working either. |
My problem was that I was using export default or displayName in the forwardRef component. version react: 17.0.2 Doesn't work: export interface ButtonProps extends React.HTMLAttributes<HTMLButtonElement> {
// ...
}
const Button = React.forwardRef<HTMLButtonElement, ButtonProps>((props, ref) => {
// ...
return (
<button className={classNames.root} {...rest} {...attrs} ref={ref}>
{children}
</button>
)
})
export default Button Doesn't work: export const Button = React.forwardRef<HTMLButtonElement, ButtonProps>((props, ref) => {
// ...
})
Button.displayName = 'RuiButton' Works: export const Button = React.forwardRef<HTMLButtonElement, ButtonProps>((props, ref) => {
// ...
return (
<button className={classNames.root} {...rest} {...attrs} ref={ref}>
{children}
</button>
)
})
Button.displayName = 'Button' // or remove |
Same issue here. |
Same issue here. |
Same issue here. |
In my case, if is default export it doesn't work. I have a polymorphic component. |
storybook : 6.5.16 NOT work const Checkbox: React.FC<CheckboxProps> = ({ children }) => {
return (
<>
<input type="checkbox" className={s.checkbox}>
{children}
</input>
</>
);
};
export default Checkbox; |
…late ArgTypes Check this storybook issue: storybookjs/storybook#13304 (comment).
…late ArgTypes Check this storybook issue: storybookjs/storybook#13304 (comment).
This issue has been open for 2 years, and this bug has persisted until version 7. It's not normal for Storybook to force an export pattern for my components. This issue should escalate in priority or at least for the maintainers to give us a solution. |
…late ArgTypes Check this storybook issue: storybookjs/storybook#13304 (comment).
@ivanzamarro I agree. In our case, no matter what type of export we have, we can't make it work (after a migration from v6 to v7). worked fine on v6, doesn't work on v7. |
@sag1v In our case, we have decided to stick with version 6 for the same problem, even having to do some hacks in the rendering of component props, but that's another separate issue. If there's anything we can help you with, feel free to reach out. |
Thanks a lot @ivanzamarro |
@ivanzamarro See my comment here. I think i found the issue or at least a part of it and a possible way to workaround it. |
* Migrate stories of Badge, Button, Checkbox and FormField to addon-controls * Migrate from themeprovider-storybook to @storybook/addon-styling * Deprecate SFC * List children prop explicitly in type definition * Run linter to fix format issue * Fix type error in PopOver * Migrate integration test demo to react 18 * Migrate to storybook v7 * Rename *.stories.mdx files to *.mdx * Migrate stories for SDK Components * Migrate stories for Providers and Hooks * Export components from their declaration statement to be able to populate ArgTypes Check this storybook issue: storybookjs/storybook#13304 (comment). * Migrate stories of Badge, Button, Checkbox and FormField to storybook v7 style * Migrate Radio UI Component * Upgrade styled-components to latest version * Migrate stories for icons * Upgrade Flex component story * Fix flex stack story * Migrate stories for several components * Migrate stories for more components * Migrate more stories for components * Migrate stories for reset components * Add copyright and changelog * Add react 18 support in peerDependencies * Fix broken links in the storybook * Fix unit tests * Re-generate package-lock.json to mitigate "... when your package.json and package-lock.json or npm-shrinkwrap.json are in sync" error --------- Co-authored-by: Venkatesh Devale <[email protected]> Co-authored-by: Kyu Simm <[email protected]>
Hi there! Thank you for opening this issue, but it has been marked as |
What other information is needed for this one? |
Describe the bug
I'm trying to get the storybook to auto implement the docs using the
@storybook/addon-docs
. The project consists of react and typescript. So far I have updated thenpx sb upgrade
and added@storybook/addon-docs
to theaddons
inmain.js
. From the documentation I just expected this to work however I'm seeingNo inputs found for this component. Read the docs
when I access the docs page within my storybook application.I have tried a few things including trying to set
docgen: 'react-docgen-typescript'
To Reproduce
I have an existing storybook app, which has various components.
Expected behavior
The Docs page should show the correct props
Screenshots
Code snippets
Current Addons
Current Packages
Example Story
System
Additional context
The app also uses CSS Modules, not sure if that affects how everything is put together
The text was updated successfully, but these errors were encountered: