React + Material UI
Google's Material Design components (MUI v9). This page shows exactly what pickstack adds to a React project for Material UI: the packages, the new files and the changes to existing ones. Every combination is installed, built, linted and tested in CI.
$ npm create pickstack@latest my-app -- --framework react --modules mui --yesCustomize in the configurator
Packages it adds
| Package | Version | Type |
|---|---|---|
@emotion/react | ^11.14.0 | runtime |
@emotion/styled | ^11.14.1 | runtime |
@mui/material | ^9.6.0 | runtime |
New files
import { createTheme } from "@mui/material/styles";
const theme = createTheme({
cssVariables: true,
});
export default theme;
Changes to existing files
+import Button from "@mui/material/Button";+import Card from "@mui/material/Card";+import CardActions from "@mui/material/CardActions";+import CardContent from "@mui/material/CardContent";+import Typography from "@mui/material/Typography"; import { useState } from "react"; export default function Counter() { const [count, setCount] = useState(0); return (+ <Card variant="outlined" sx={{ minWidth: 240, textAlign: "center" }}>+ <CardContent>+ <Typography variant="h6" component="h2">+ Counter+ </Typography>+ <Typography+ variant="h3"+ component="p"+ sx={{ fontWeight: 700, fontVariantNumeric: "tabular-nums" }}− <div className="card">− <p className="count">{count}</p>− <div className="row">− <button− type="button"− className="btn"− onClick={() => setCount((n) => n - 1)} >+ {count}+ </Typography>+ </CardContent>+ <CardActions sx={{ justifyContent: "center", pb: 2 }}>+ <Button variant="outlined" onClick={() => setCount((n) => n - 1)}> -1+ </Button>+ <Button variant="contained" onClick={() => setCount((n) => n + 1)}>− </button>− <button− type="button"− className="btn"− onClick={() => setCount((n) => n + 1)}− > +1+ </Button>+ </CardActions>+ </Card>− </button>− </div>− </div> ); }
+import CssBaseline from "@mui/material/CssBaseline";+import { ThemeProvider } from "@mui/material/styles"; import { StrictMode } from "react"; import { createRoot } from "react-dom/client"; import App from "./App";+import theme from "./theme"; import "./index.css"; createRoot(document.getElementById("root")!).render( <StrictMode>+ <ThemeProvider theme={theme}>+ <CssBaseline />+ <App />+ </ThemeProvider>− <App /> </StrictMode>, );
Project files
.gitignoreREADME.mdindex.htmlpackage.jsonsrc/App.tsxsrc/components/Counter.tsxsrc/index.csssrc/main.tsxsrc/theme.tstsconfig.jsonvite.config.ts