Decorators in HTML edition of Storybook #24661
-
I'm following up on a question I posted on discord. I am trying to wrap all of my stories inside of a component and it was pointed out that decorators were exactly what I wanted. However, the examples given (linked) are for React and I can't seem to get them working in the HTML version of Storybook. The docs say: Using the snippet verbatim throws an error and tells me that to use JSX, rename preview.js to preview.jsx. If I do that, Storybook builds, but it doesn't apply the decorator. Is this possible in the HTML version? |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments
-
I am using HTML version as well, and we are using a few decorators! .storbyook/preview.js
|
Beta Was this translation helpful? Give feedback.
-
Thanks @renatewr . I got it working. I think it was user error, as we were already exporting decorators and I didn't see it. But docs for my build (HTML/Vite) would certainly improve confidence in using features like this. Now I am trying to adjust the story's root to not show the wrapping tags in the HTML panel, but having trouble finding where that goes. I could do that in an older project. Edit: This is part of the HTML add-on, which is why I was having trouble finding it. All good now. |
Beta Was this translation helpful? Give feedback.
-
Hi @dgibson666 do you mind posting a snippet of how you are configuring and using decorators in Storybook HTML? Trying to make sure I am not missing out on your findings. Thank you. |
Beta Was this translation helpful? Give feedback.
I am using HTML version as well, and we are using a few decorators!
.storbyook/preview.js