-
-
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
Addon-docs: Exclude defaultProps from source #11510
Comments
I'm also having the same issue. Is there any workaround for this like hiding the prop? |
No workaround yet AFAIK. Will try to take a look soon. |
Hi everyone! Seems like there hasn't been much going on in this issue lately. If there are still questions, comments, or bugs, please feel free to continue the discussion. Unfortunately, we don't have time to get to every issue. We are always open to contributions so please send us a pull request if you would like to help. Inactive issues will be closed after 30 days. Thanks! |
@shilman @Lueton This is actually possible in Storybook 6.0. As you can see in In my opinion, I feel like storybook should have the For now though, you can just use the Note: This is the CSF style export default {
title: 'Example/Container',
component: Container,
parameters: {
jsx: {
showDefaultProps: false
},
}
}; |
Great catch @zeckdude! Want to create a PR for that? Will merge, esp if there are tests. |
Thanks @shilman. There's actually no PR necessary. That On another note though, the jsx: {
showDefaultProps: false, // Omit default props on code preview
filterProps: value => {
// Omit empty functions (they're likely from default props and `showDefaultProps` doesn't catch those)
if (!isFunction(value)) {
return true;
}
return value.toString() !== '() => {}';
},
}, |
@zeckdude I meant a PR setting the default value so that no workaround is needed. seems like this should be the out of box behavior |
@shilman Ah gotcha. I can make that happen. What's your take on my solution for the empty function callback default prop value? |
I think we need a better way to deal with functions. Will chew on it. |
@shilman Great. I've also left an issue at algolia/react-element-to-jsx-string#585 to see if they can build that into their package. |
Awesome, thanks! I'm not sure whether it's maintained. If it is, there are probably a lot of workarounds from our side that would be more appropriate to fold into the underlying library 🙈 |
@shilman This can be closed. |
Will close automatically when released @zeckdude . Thanks! |
Ta-da!! I just released https://github.com/storybookjs/storybook/releases/tag/v6.1.0-beta.2 containing PR #13003 that references this issue. Upgrade today to the
Closing this issue. Please re-open if you think there's still more to do. |
It would be great if (if not already available) there was an option to exclude
defaultProps
from the source output.Button.tsx
Button.stories.mdx
current behavior of addon-docs source code
desired behavior
The text was updated successfully, but these errors were encountered: