Skip to content
Discussion options

You must be logged in to vote

There you can the that sx is sx="[object Object]"

Okay, so the JSX pragma running in Storybook doesn't know about sx prop.
Is your Storybook using the same Babel config as your Next.js app?

Edit: I cloned your repo and managed to fix it.

Add the following to .storybook/.babelrc to tell Storybook about your Babel setup.

{
  "extends": "../babel.config.js"
}

Explanation: The part of configuration that makes sx prop work on intrinsic elements like <div /> is this:

    [
      "next/babel",
      {
        "preset-react": {
          importSource: "theme-ui",
          runtime: "automatic",
          throwIfNamespace: false,
        },
      },
    ]

We tell Next's Babel Preset to tell Ba…

Replies: 4 comments 2 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
2 replies
@seisenreich
Comment options

@hasparus
Comment options

Answer selected by hasparus
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
3 participants
Converted from issue

This discussion was converted from issue #1872 on July 28, 2021 10:59.