Replies: 4 comments
-
Are the advantages and differences documented somewhere? I did not know the web components version could do this and it seems mostly the same as the html version that I used in the past with stencil (per an older tutorial). |
Beta Was this translation helpful? Give feedback.
-
I've been using the |
Beta Was this translation helpful? Give feedback.
-
Hi, I'm a maintainer of FAST as well as Fluent Web Components where we're using
We have a I think a bigger issue is that the automatic control generation handled by |
Beta Was this translation helpful? Give feedback.
-
Throwing our use case into the ring here. My team uses @storybook/web-components with Lit, instead of using the out of the box control generation we leverage this addon alongside this analyzer, I've documented our process here. To be fair I've never thought that the web-components exporter purely relied on Lit, but even if I wasn't using Lit I'm not sure that that'd have stopped me if it's used purely as a convenience to render HTML in a story. While I appreciate I can render things directly, using my own framework of choice, writing other framework code within the context of Storybook is not unfamiliar, for example we have to write React components already for Storybook doc blocks. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Summary
Re-export Lit’s
html
template tag from@storybook/web-components
to improve adoption among non-Lit WC users, who mistakenly think that Storybook WC is Lit-specific.Problem Statement
@storybook/web-components
uses Lit for custom render functions:Thanks to its peer dependency on
lit
and the import in the story file, there is a preconception that Storybook WC is somehow Lit-specific.As a result of this misunderstanding, users of other WC frameworks such as FAST often use
@storybook/html
, and forego benefits of@storybook/web-components
like automatic control generation.Non-goals
Different WC folks have proposed making it possible to to provide custom render function handlers so that users can create their own. This is already possible, but we have not documented it because we don't want to increase the surface area and fragment the space.
Implementation
To solve this problem, we propose re-exporting
html
from@storybook/web-components
renderer and the frameworks@storybook/web-components-vite
/@storybook/web-components-webpack5
. Thelit
peer dependency would become alit-html
dependency, and the story import would change as well:NOTE: Render function can also return a plain HTML string as its output.
Prior Art
???
Deliverables
lit-html
and re-exporthtml
from the renderer (@storybook/web-components
) and frameworks (@storybook/web-components-vite
,@storybook/web-components-webpack5
).@storybook/html
and@storybook/web-components
docs that@storybook/web-components
is the recommendation for all WC projects.Risks
lit
in their stories than justhtml
, and we need to add a fulllit
dependency instead and export more utilities (lit
depends onlit-html
).Unresolved Questions
No response
Alternatives considered / Abandoned Ideas
No response
Beta Was this translation helpful? Give feedback.
All reactions