Skip to content

MUI v5 does not appear in Storybook Docs tab? #28716

Closed

Description

@vikas990

I was working on Material UI v4 but after the release of MUI (Material UI V5) I have shifted on that but after shifting I cant see anything on storybook docs tab.
Material-UI (V5)
Screenshot 2021-09-30 at 5 01 50 PM
Screenshot 2021-09-30 at 5 01 56 PM

  • The issue is present in the latest release.
  • I have searched the issues of this repository and believe that this is not a duplicate.

Current Behavior 😯

I Can't see anything on the Storybook docs tab after upgrading to V5.

Expected Behavior 🤔

It should the Docs on the storybook.

Steps to Reproduce 🕹

Git repository:- https://github.com/vikas990/bug.git
Steps:

  1. npm install
  2. npm run storybook

Context 🔦

I m try to document the design on my website.

Your Environment 🌎

`npx @mui/envinfo`
  Don't forget to mention which browser you used.
  Output from `npx @mui/envinfo` goes here.

Activity

  1. added
    status: waiting for maintainer
    on Sep 30, 2021
  2. mbrevda commented on Sep 30, 2021

    @mbrevda
  3. vikas990 commented on Oct 1, 2021

    @vikas990
    Author

    I have tried this but after I update .storybook/main.js its keeps on loading even I cant see the stories after updateing.

  4. added
    status: waiting for author
    and removed
    status: waiting for maintainer
    on Oct 1, 2021
  5. siriwatknp commented on Oct 1, 2021

    @siriwatknp
    Member

    @vikas990 Please provide a CodeSandbox (https://material-ui.com/r/issue-template-latest), a link to a repository on GitHub, or provide a minimal code example that reproduces the problem.

    Here are some tips for providing a minimal example: https://stackoverflow.com/help/mcve

  6. vikas990 commented on Oct 1, 2021

    @vikas990
    Author

    This is the CodeSandbox example:- https://codesandbox.io/s/cool-alex-dmiri?file=/package.json.

    This is the git repository:- https://github.com/vikas990/bug.git
    Steps:-

    1. after you have cloned the repo
    2. do npm install
    3. after that do npm run storybook.

    After doing that you can see a storybook with 2 Button stories. one with the Material UI V4 and one with Material UI v5.
    the Story with Material UI v5 do show anything on the docs tab.
    thank you.

  7. siriwatknp commented on Oct 3, 2021

    @siriwatknp
    Member

    I tried the repo you provide with these adjustments and it works.

    .storybook/preview.js

    import CssBaseline from "@mui/material/CssBaseline";
    import { ThemeProvider, createTheme } from "@mui/material/styles";
    
    import { ThemeProvider as EmotionThemeProvider } from "emotion-theming";
    
    const defaultTheme = createTheme();
    
    const withThemeProvider = (Story, context) => {
      return (
        <EmotionThemeProvider theme={defaultTheme}>
          <ThemeProvider theme={defaultTheme}>
            <CssBaseline />
            <Story {...context} />
          </ThemeProvider>
        </EmotionThemeProvider>
      );
    };
    
    export const decorators = [withThemeProvider];
    
    export const parameters = {
      actions: { argTypesRegex: "^on[A-Z].*" },
      controls: {
        matchers: {
          color: /(background|color)$/i,
          date: /Date$/,
        },
      },
    };

    .storybook/main.js

    const path = require("path");
    const toPath = (filePath) => path.join(process.cwd(), filePath);
    
    module.exports = {
      stories: [
        "../stories/**/*.stories.mdx",
        "../stories/**/*.stories.@(js|jsx|ts|tsx)",
      ],
      addons: [
        "@storybook/addon-links",
        "@storybook/addon-essentials",
        "@storybook/addon-docs",
      ],
      webpackFinal: async (config) => {
        return {
          ...config,
          resolve: {
            ...config.resolve,
            alias: {
              ...config.resolve.alias,
              "@emotion/core": toPath("node_modules/@emotion/react"),
              "emotion-theming": toPath("node_modules/@emotion/react"),
            },
          },
        };
      },
    };

    Screen Shot 2564-10-03 at 10 08 50

    also this issue is duplicated with #24282 (will update the migration doc)

  8. added
    external dependency
    and removed
    status: waiting for author
    on Oct 3, 2021
  9. changed the title [-]After Using Material-UI v5 (MUI) i can't see anything on Storybook Docs tab?[/-] [+]MUI v5 does not appear in Storybook Docs tab?[/+] on Oct 3, 2021
  10. vikas990 commented on Oct 3, 2021

    @vikas990
    Author

    it's working now thank you for the help and for the quick response.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

external dependency

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions