Introduction
The docs & UI setup command line currently don’t support Material UI, so thought I’d put together a quick tutorial. I do plan to contribute a UI setup command to perform the below automatically.
Install MUI
As per the guide: Installation - Material UI
-
Install dependencies.
yarn workspace web add @mui/material @emotion/react @emotion/styled @fontsource/roboto @mui/icons-material
-
Include the Roboto font in your React entry point. Edit your
App.tsx
orApp.jsx
file and add the following, I put this just below the index.css import.
import '@fontsource/roboto/300.css';
import '@fontsource/roboto/400.css';
import '@fontsource/roboto/500.css';
import '@fontsource/roboto/700.css';
Confirmation
Verify your MUI component installation is now working:
-
Create a TestPage in your project.
yarn rw g page Test
. -
Place an MUI Button in the page.
<Button variant="contained">Hello World</Button>
. -
At the top of the file, ensure you import your button from MUI.
import { Button } from '@mui/material'
Verify your MUI Icons installation is working:
-
Within your test page add the Material UI ABC Icon.
<AbcIcon fontSize="large" />
. -
Ensure the icon is imported.
import AbcIcon from '@mui/icons-material/Abc'
.