Open boyatbeebee opened 1 year ago
💯
I would only point at that this is a (I think critical) feature request, not technically a bug.
Note that react Meta.component
type is a class, and web component Meta.component
type is string.
The react renderer understands react. That's why you can do cool things like not pass a render()
method, and it will know by itself how to pass the story args
to the component.
The web component renderer doesn't have any understanding of webcomponent internals - it just takes a string. Which is probably because the storybook team doesn't want to choose one webcomponent framework to the exclusion of all else?
But I would suggest that a native web component (and lit is a native web component) will end up inheriting from HtmlElement
. Component could be typed as HtmlElement
(Or HtmlElement | string
), and can be parsed like any other typescript class, and can have their properties set just like it would any other HtmlElement
.
So turns out that you could get autodocs from jsdocs on the lit element, if you run an analyzer first. https://storybook.js.org/docs/web-components/essentials/controls#choosing-the-control-type I'd rather have storybook pick it up itself from the class, but this isn't too much to add to the build.
Thank you @yringler for that comment. If I hadn't read it I would still be trying to figure out why autodocs isn't picking up my JSdoc. It is indeed not too much to add it to the build yourself but Storybook could have definitely done a better job at telling people this is such an important step for Web-components.
This has not been addressed in v8, just FYI.
Describe the bug
When using the
tags: ["autodocs"]
feature together wit a Lit component the jsdoc comments in the component file do not show up in the Storybook docs page.To Reproduce
https://codesandbox.io/p/sandbox/storybook-lit-and-autodocs-gzktrj?file=/stories/Button.js:7,15
To use:
npm i
followed bynpm run dev
This repo has a clean install using
npx storybook@latest init
In the wizard I chose vite and web-components.
Button.js
has jsdoc comments at the top. These comments do not show up in the corresponding docs page.System
Additional context
No response