How to use the @storybook/addon-contexts/vue.withContexts function in @storybook/addon-contexts

To help you get started, we’ve selected a few @storybook/addon-contexts examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github storybookjs / storybook / examples / vue-kitchen-sink / src / stories / addon-contexts.stories.js View on Github external
{
    title: 'CSS Themes',
    params: [
      {
        name: 'Forest',
        props: {
          style: { color: 'teal', background: '#00b894', height: '100vh', padding: '10px' },
        },
      },
    ],
  },
];

export default {
  title: 'Addon/Contexts',
  decorators: [withContexts(topLevelContexts)],
};

export const simpleCssTheming = () => ({
  template: "<span>I'm a children of the injected 'div' (where provides a theming context).</span>",
});

simpleCssTheming.story = {
  name: 'Simple CSS Theming',
  parameters: {
    contexts: storyLevelContexts,
  },
};

// Example B: Language (Vue provide/inject API)
const createContext = initialValue =&gt; {
  const uid = `_${Date.now()}${Math.random()}`;

@storybook/addon-contexts

Storybook Addon Contexts

MIT
Latest version published 4 years ago

Package Health Score

72 / 100
Full package analysis