Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Global knob to have values shared between all stories #97

Open
caiovisk opened this issue Dec 19, 2022 · 0 comments
Open

Global knob to have values shared between all stories #97

caiovisk opened this issue Dec 19, 2022 · 0 comments

Comments

@caiovisk
Copy link

Need to have a Knob that keep its value when changing between stories.

For example, a Font Size options knob that is present on all stories:

context.knobs.options(
      label: 'Font Size',
      initial: '12',
      options: [
        const Option<String>(
          label: '10',
          value: '10',
        ),
        const Option<String>(
          label: '11',
          value: '11',
        ),
        const Option<String>(
          label: '12',
          value: '12',
        ),
        const Option<String>(
          label: '13',
          value: '13',
        ),
        const Option<String>(
          label: '14',
          value: '14',
        )
      ],
    );

Screen Shot 2022-12-19 at 12 23 10 pm

The "issue" is when I select a different value, let's say 11, and navigates to a different story, the "Font Size" knob value gets reset to its initial value. So there is a need to select the knob again.

Is there a way I could declare a global knob of "settings" or have its initial value to be kept between all stories??

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant