How to update globals from my decorator in "storybook": "^8.6.14", #31548
Unanswered
kristijorgji
asked this question in
Help
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Summary
I have posted the full question with details at
https://stackoverflow.com/questions/79633809/how-can-i-update-storybook-global-theme-syncing
Shortly:
I added a custom globals named "theme" to storybook.
I want to know how can I update this dynamically and see the changed value in my custom toolbar item.
I need also my Preview decorator to read proper updated value on change so uses the correct theme (background color)
I have studied already existing documentations like
https://storybook.js.org/docs/essentials/toolbars-and-globals
They show how to update globals from an addon only. From decorator if I use
useGlobals
I get error that context provider is missing.Also using
does nothing, no changes happen.
Additional information
No response
Create a reproduction
No response
Beta Was this translation helpful? Give feedback.
All reactions