[Backgrounds addon] Set a different default background for a specific story
See original GitHub issueIs your feature request related to a problem? Please describe. I have a component prop that controls whether the component is visible on a dark background or a light background. In the dark-background story, I’d like to default to the dark background by name, rather than overriding all the backgrounds for that component.
Describe the solution you’d like Something like:
storiesOf("Logo", module)
.add("horizontal", () => <Logo layout="horizontal" />)
.add("vertical", () => <Logo layout="vertical" />)
.add("horizontal - inverted", () => <Logo layout="horizontal" inverted/>, {defaultBackground: "primary"})
.add("vertical - inverted", () => <Logo layout="vertical" inverted/>, {defaultBackground: "primary"});
Describe alternatives you’ve considered I saw on the documentation page that you can override the background for a component, but I don’t see a way to leave the other options and just change which one is the default. It may be possible, but I don’t see how in the documentation.
Are you able to assist bring the feature to reality? Maybe; I’m not sure if I can.
Issue Analytics
- State:
- Created 4 years ago
- Comments:14 (11 by maintainers)
Top Results From Across the Web
Backgrounds - Storybook - JS.ORG
The backgrounds toolbar addon allows you to set the background color in which the story renders in the UI: Configuration. By default, the...
Read more >Storybook: background change on prop change
With a few lines of code, storybook can automatically change the background color whenever certain props on your component change.
Read more >@storybook/addon-backgrounds - npm
Storybook Addon Backgrounds. Storybook Addon Backgrounds can be used to change background colors inside the preview in Storybook.
Read more >problems with storybook with Background parameters
I'm on a project with a storybook and I want my story to be able to change the background or ...
Read more >How to Change Background Color in Instagram Story?
3. How to change the background color without covering the photo ... If you don't want to cover the photo, then you need...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Turns out that #9219 doesn’t really apply. Here’s what I’m thinking for a better backgrounds API. We can deprecate the old API in 6.0 and remove it in 7.0:
The
defaultBackground
method looks perfect! It’s exactly what I was thinking of.