Back to Storybook

Args In Preview

docs/_snippets/args-in-preview.md

10.3.62.9 KB
Original Source
js
export default {
  // The default value of the theme arg for all stories
  args: { theme: 'light' },
};
ts
// Replace your-framework with the framework you are using, e.g. react-vite, nextjs, vue3-vite, etc.
import type { Preview } from '@storybook/your-framework';

const preview: Preview = {
  // The default value of the theme arg for all stories
  args: { theme: 'light' },
};

export default preview;
ts
// Replace your-framework with the framework you are using (e.g., react-vite, nextjs, nextjs-vite)
import { definePreview } from '@storybook/your-framework';

export default definePreview({
  // The default value of the theme arg for all stories
  args: { theme: 'light' },
});
<!-- JS snippets still needed while providing both CSF 3 & Next -->
js
// Replace your-framework with the framework you are using (e.g., react-vite, nextjs, nextjs-vite)
import { definePreview } from '@storybook/your-framework';

export default definePreview({
  // The default value of the theme arg for all stories
  args: { theme: 'light' },
});
ts
import { definePreview } from '@storybook/vue3-vite';

export default definePreview({
  // The default value of the theme arg for all stories
  args: { theme: 'light' },
});
<!-- JS snippets still needed while providing both CSF 3 & Next -->
js
import { definePreview } from '@storybook/vue3-vite';

export default definePreview({
  // The default value of the theme arg for all stories
  args: { theme: 'light' },
});
ts
import { definePreview } from '@storybook/angular';

export default definePreview({
  // The default value of the theme arg for all stories
  args: { theme: 'light' },
});
ts
import { definePreview } from '@storybook/web-components-vite';

export default definePreview({
  // The default value of the theme arg for all stories
  args: { theme: 'light' },
});
<!-- JS snippets still needed while providing both CSF 3 & Next -->
js
import { definePreview } from '@storybook/web-components-vite';

export default definePreview({
  // The default value of the theme arg for all stories
  args: { theme: 'light' },
});