-
-
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
Storybook not rendering all React props in the controls and docs when using imported types #12493
Comments
can you share your |
Hey @shilman! This is the module.exports = {
stories: [
'../**/*.stories.mdx',
'../**/*.stories.@(js|jsx|ts|tsx)'
],
addons: ['@storybook/addon-essentials'],
}; Sorry the repo is private, but if anything else is needed I'm happy to help. |
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! |
I am experiencing this same issue, and it looks like others are as well. See #13548. Can we reactivate this? |
@jmpolitzer Do you have a repro repo you can share? |
@shilman Thanks for the response. It turns out that my issue revolved around components imported from an external library, which I found a fix for here. I believe this can be closed. |
I am having this issue, all my other components work fine, but all of a sudden this new one doesnt? And i cant figure out why. // storybook
import React from 'react'
import { ComponentStory } from '@storybook/react'
import IconText from '../../components/theme/Diageo/DIconText'
import LocationIcon from '../../components/icons/LocationIcon'
// More on default export: https://storybook.js.org/docs/react/writing-stories/introduction#default-export
export default {
title: 'Base/IconText',
component: IconText,
}
// More on component templates: https://storybook.js.org/docs/react/writing-stories/introduction#using-args
const Template: ComponentStory<typeof IconText> = (args) => <IconText {...args} />
export const Base = Template.bind({}) // IconText component
import React from 'react'
type IconTextProps = {
icon: JSX.Element
text: string
reversed?: boolean
className?: string
}
export default function IconText({ icon, text, reversed, className, ...props }: IconTextProps) {
return (
<div className={`icon-text ${className} ${reversed ? 'icon-text-reversed' : null}`} {...props}>
<span className="icon-text-icon">{icon}</span>
<span className="icon-text-text">{text}</span>
</div>
)
} |
I think a good fix for this would be possibly having another field in the default export for the story for the props interface to be added to rather than trying to find it from the component itself. For me it doesnt seem to be picking up extended types.
The storybook only contains the children control but non of the controls within the other interfaces |
Same with me. import SlotButton from "..";
import type { Meta, StoryObj } from "@storybook/react";
const meta: Meta<typeof SlotButton> = {
title: "SlotButton",
component: SlotButton,
parameters: { actions: { argTypesRegex: "^on.*" } },
};
export default meta;
type Story = StoryObj<typeof SlotButton>;
export const Primary: Story = { args: { label: "BUTTON" } }; |
Hi there! Thank you for opening this issue, but it has been marked as |
I'm afraid we need to close this issue for now, since we can't take any action without the requested reproduction or additional information. But please don't hesitate to open a new issue if the problem persists – we're always happy to help. Thanks so much for your understanding. |
We have upgraded react-docgen recently to version 7. You can try to activate it and see whether your issues get resolved. Please make sure to install at least Storybook 7.6.0-alpha.2 and configure using |
Hi there! Thank you for opening this issue, but it has been marked as |
I'm afraid we need to close this issue for now, since we can't take any action without the requested reproduction or additional information. But please don't hesitate to open a new issue if the problem persists – we're always happy to help. Thanks so much for your understanding. |
I'm able to replicate this by writing a very basic component using MUI TextField. As a functional component written as a const, the story renders but shows the
When rewriting the functional component as a function, the story shows the
The story is the same in both situations.
|
For those who are using Material UI: Add the following to your
important line (worked for me since I'm using a monorepo): It's better to use this if it works for your setup:
|
Describe the bug
Storybook is not showing all the props in controls and docs. It happens when I import a Typescript type from another file.
To Reproduce
If I do that, only
text
appears in the controls and docs.Expected behavior
All props should appear in the controls and docs panels.
Screenshots
This is my props definition:
This is what appears in controls. It is missing
iconColor
andcolor
.This is what appears in docs. Also missing
iconColor
andcolor
andicon
has no description.This is the typing of
Icons
,TextColor
andButtonColor
:Code snippets
See to reproduce section
System:
System:
OS: Windows 10 10.0.19041
CPU: (4) x64 Intel(R) Core(TM) i7-4500U CPU @ 1.80GHz
Binaries:
Node: 12.13.0 - C:\Program Files\nodejs\node.EXE
npm: 6.12.0 - C:\Program Files\nodejs\npm.CMD
Browsers:
Chrome: 85.0.4183.102
Edge: Spartan (44.19041.423.0), Chromium (85.0.564.51)
npmGlobalPackages:
@storybook/cli: 6.0.21
The text was updated successfully, but these errors were encountered: