Skip to content

storyblok/mui

Repository files navigation

@storyblok/mui

A MUI Theme with multiple additional reusable components for Storyblok.

Node.js Package

@storybook/mui is a component library based on MUI. It is the ideal package to use for building Storyblok extensions with React as it takes care of the task of styling your components and lets you focus on building business logic. Thus, extensions built with @storybook/mui will seamlessly, visually integrate into Storyblok.

Find the full documentation for this package here.

What is MUI?

From mui.com:

MUI is an open-source React component library that implements Google's Material Design.

It includes a comprehensive collection of prebuilt components that are ready for use in production right out of the box.

What is included in this package?

@storybook/mui consists of a MUI theme that styles the MUI standard components according to Storyblok's design system. Since @storybook/mui is based on MUI, all the MUI standard components are available. Some of these components are visualised in the MUI Components section.

@storybook/mui also provides some additional components that are unique to this package. For example, the <AppLayout /> component is great for building custom application extensions. The documentation for all these components is located here.

Getting Started

The steps below explains how to include @storyblok/mui in your project.

Prerequisites

First of all, set up MUI with the help of MUI's official documentation.

With npm:

npm install @mui/material @emotion/react @emotion/styled

With yarn:

yarn add @mui/material @emotion/react @emotion/styled

Installation

Install @storyblok/mui:

npm install --save-exact @storyblok/mui

With yarn:

yarn add --exact @storyblok/mui

Wrap your application within a <ThemeProvider /> component:

import { lightTheme } from '@storyblok/mui'
import {
  CssBaseline,
  Button,
  ThemeProvider
} from "@mui/material";

const App = () => (
    <ThemeProvider theme={lightTheme}>
      <CssBaseline />
      <Button>
        Hello
      </Button>
    </ThemeProvider>
)