Skip to content

Decorators from preview.ts not applying #32179

Answered by dosubot bot
alex-taxiera asked this question in Help
Discussion options

You must be logged in to vote

Hi @alex-taxiera! I'm Dosu and I’m helping the storybook team.

The reason your global decorator isn't applying is because in Storybook v9.1.0, global decorators must be defined at the top level of your preview.ts file, not inside the parameters object. The decorators array inside parameters is ignored—only the top-level decorators array is used for global decorators docs.

Here's how your preview.ts should look:

import type { Preview } from "@storybook/react-vite";
import "../src/index.css";
import { withMyDecorator } from "./decorator";

const preview: Preview = {
  decorators: [withMyDecorator], // <-- move this out of parameters
  parameters: {
    controls: {
      matchers: {
        c…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by alex-taxiera
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Help
Labels
None yet
1 participant