Skip to content

Types

AddonOptions

Options object passed to the addon in .storybook/main.ts. See the Configuration guide for full descriptions.

ts
interface AddonOptions {
  patternsRoot: string;
  namespaces: Record<string, string>;
  extraPatternRoots?: string[];
  macrosRoot?: string;
  extraMacrosRoots?: string[];
  scssVariablesPath?: string;
  sassDataKey?: string;        // default: 'sass_data'
  sassAdditionalData?: string;
  templateGlob?: string;
  globalContext?: Record<string, unknown> | false;
}

WordPressContextMock

Reference shape describing the default WordPress/Timber context injected into every story's args. This type is provided as a convenience reference only — the globalContext addon option accepts any Record<string, unknown>, so you are not limited to this shape.

ts
interface WordPressContextMock {
  site: Record<string, unknown>;
  options: Record<string, unknown>;
  menus: Record<string, unknown>;
  widgets: Record<string, unknown>;
}

The default values injected are:

ts
{
  site: {
    name: '',
    url: 'http://localhost',
    description: '',
    language: 'en-US',
  },
  options: {},
  menus: {},
  widgets: {},
}

In addition, the parsed contents of scssVariablesPath are merged in at the same level under the key set by sassDataKey (default: sass_data). It is not part of WordPressContextMock since its shape depends on your project's SCSS variables.

Override any field in a specific story via args:

ts
export const FrenchLocale: StoryObj = {
  args: {
    site: { name: 'Mon Site', url: 'http://localhost', language: 'fr-FR', description: '' },
  },
};

Released under the MIT License.