{"id":"6b09417e5ce40d447918f2c1","slug":"mui","title":"MUI 7 in practice – theming, dark mode, custom components and DataGrid without the \"default Material\" look","summary":"We build a dumpling shop's kitchen dashboard in Material UI 7 – design tokens and a CSS-variables theme, flicker-free dark mode, custom components and variants, client- and server-side DataGrid, and a form with react-hook-form and Zod. The code also runs on MUI 9.","servedLang":"en","availableLangs":["pl","en"],"topics":["mui","react"],"techs":["typescript","javascript"],"tags":["material-ui","mui-7","mui-x","data-grid","design-tokens","dark-mode","theming","react-hook-form","zod"],"level":"intermediate","kind":"tutorial","access":"members","status":"published","cover":null,"author":{"id":"6b08bd2e80884893657cc8cf","name":"Redakcja Art of Devs","avatar":null,"handle":"redakcja","community":false},"readingMinutes":23,"stats":{"views":2,"likes":0,"bookmarks":0,"comments":0},"publishedAt":"2026-11-27T08:38:22.505Z","updatedAt":"2026-11-27T13:03:21.177Z","requestedLang":"en","theme":{"hero":"classic","heroMedia":null,"accent":"indigo","background":"hex","weaveResources":true,"toc":"right"},"seoDescription":"Material UI (MUI 7) step by step – createTheme with colorSchemes and cssVariables, design tokens, dark mode with useColorScheme, styled and sx, a custom button variant, type augmentation, MUI X DataGrid (server-side pagination, actions), forms with react-hook-form + Zod, and how to avoid the default","wordCount":4506,"doc":{"type":"doc","content":[{"type":"paragraph","content":[{"type":"text","text":"MUI is the most popular React component library, but it has an image problem: apps built \"on the defaults\" all look the same – a blue app bar, upper-case buttons, a shadow under every card. In this guide you'll build a kitchen dashboard for a dumpling shop that uses everything MUI is good at (accessibility, ready-made components, DataGrid) but looks like a product with its own design system."}]},{"type":"callout","attrs":{"variant":"info","title":"In short"},"content":[{"type":"bulletList","content":[{"type":"listItem","content":[{"type":"paragraph","content":[{"type":"text","text":"Tokens first, theme second.","marks":[{"type":"bold"}]},{"type":"text","text":" Colours, radii and fonts live in one "},{"type":"text","text":"tokens.ts","marks":[{"type":"code"}]},{"type":"text","text":" file, and "},{"type":"text","text":"createTheme","marks":[{"type":"code"}]},{"type":"text","text":" just maps them. A rebrand means changing one file, not a hundred components."}]}]},{"type":"listItem","content":[{"type":"paragraph","content":[{"type":"text","text":"CSS variables + ","marks":[{"type":"bold"}]},{"type":"text","text":"colorSchemes","marks":[{"type":"code"}]},{"type":"text","text":" give you light, dark and system modes without re-rendering React and without a flash on load. The "},{"type":"text","text":"useColorScheme()","marks":[{"type":"code"}]},{"type":"text","text":" hook switches the mode and remembers the choice."}]}]},{"type":"listItem","content":[{"type":"paragraph","content":[{"type":"text","text":"DataGrid","marks":[{"type":"bold"}]},{"type":"text","text":" from MUI X handles sorting, filters, pagination and row actions. For large data sets you switch it to server mode and feed it with TanStack Query."}]}]}]}]},{"type":"callout","attrs":{"variant":"tip","title":"What you'll build"},"content":[{"type":"paragraph","content":[{"type":"text","text":"A \"Pierogarnia · Kitchen\" admin panel in Vite + React 19 + MUI 7: stat tiles, a table of 240 orders (sorting, filtering, selection, cancelling from a row menu), a second table in server mode, an add-dish form with Zod validation and a light / system / dark switch. The code (16 files) was checked on MUI 7.3 and MUI 9.6 – download it as a ZIP from the icon next to the article."}]}]},{"type":"paragraph","content":[{"type":"text","text":"Prerequisites:","marks":[{"type":"bold"}]},{"type":"text","text":" React with hooks and TypeScript at the level of the "},{"type":"text","text":"TypeScript guide","marks":[{"type":"link","attrs":{"href":"/en/articles/typescript"}}]},{"type":"text","text":". Knowing react-hook-form and TanStack Query from the "},{"type":"text","text":"React guide","marks":[{"type":"link","attrs":{"href":"/en/articles/react"}}]},{"type":"text","text":" helps, but isn't required."}]},{"type":"stats","attrs":{"items":[{"value":"7 → 9","label":"MUI versions","hint":"the same code runs on both"},{"value":"3","label":"colour modes","hint":"light, dark, system"},{"value":"240","label":"DataGrid rows","hint":"sorting, filters and actions with no custom code"},{"value":"1","label":"tokens file","hint":"the whole brand in one place"}]}},{"type":"heading","attrs":{"level":2,"id":"step-1-installation"},"content":[{"type":"text","text":"Step 1. Installation"}]},{"type":"codeBlock","attrs":{"language":"bash"},"content":[{"type":"text","text":"npm create vite@latest pierogi-admin -- --template react-ts\ncd pierogi-admin\nnpm install @mui/material @mui/icons-material @emotion/react @emotion/styled @mui/x-data-grid @fontsource-variable/inter\nnpm install react-hook-form @hookform/resolvers zod @tanstack/react-query"}]},{"type":"paragraph","content":[{"type":"text","text":"MUI uses Emotion as its styling engine, hence the two "},{"type":"text","text":"@emotion/*","marks":[{"type":"code"}]},{"type":"text","text":" packages. The Inter font is installed locally via Fontsource – no requests to Google Fonts and no layout shift when a web font arrives late."}]},{"type":"codeGroup","attrs":{"title":"Project configuration"},"content":[{"type":"codeBlock","attrs":{"language":"json","filename":"package.json"},"content":[{"type":"text","text":"{\n  \"name\": \"pierogi-admin-mui\",\n  \"private\": true,\n  \"version\": \"0.1.0\",\n  \"type\": \"module\",\n  \"scripts\": {\n    \"dev\": \"vite\",\n    \"build\": \"tsc --noEmit && vite build\",\n    \"preview\": \"vite preview\"\n  },\n  \"dependencies\": {\n    \"@emotion/react\": \"^11.14.0\",\n    \"@emotion/styled\": \"^11.14.1\",\n    \"@fontsource-variable/inter\": \"^5.3.0\",\n    \"@hookform/resolvers\": \"^7.0.9\",\n    \"@mui/icons-material\": \"^7.3.11\",\n    \"@mui/material\": \"^7.3.11\",\n    \"@mui/x-data-grid\": \"^9.18.0\",\n    \"@tanstack/react-query\": \"^5.108.4\",\n    \"react\": \"^19.3.1\",\n    \"react-dom\": \"^19.3.1\",\n    \"react-hook-form\": \"^7.92.0\",\n    \"zod\": \"^4.6.7\"\n  },\n  \"devDependencies\": {\n    \"@types/react\": \"^19.3.0\",\n    \"@types/react-dom\": \"^19.3.0\",\n    \"@vitejs/plugin-react\": \"^6.3.0\",\n    \"typescript\": \"~7.0.2\",\n    \"vite\": \"^8.4.0\"\n  }\n}"}]},{"type":"codeBlock","attrs":{"language":"json","filename":"tsconfig.json"},"content":[{"type":"text","text":"{\n  \"compilerOptions\": {\n    \"target\": \"es2023\",\n    \"lib\": [\"ES2023\", \"DOM\", \"DOM.Iterable\"],\n    \"module\": \"esnext\",\n    \"moduleResolution\": \"bundler\",\n    \"types\": [\"vite/client\"],\n    \"jsx\": \"react-jsx\",\n    \"noEmit\": true,\n    \"allowImportingTsExtensions\": true,\n    \"verbatimModuleSyntax\": true,\n    \"skipLibCheck\": true,\n    \"noUncheckedIndexedAccess\": true\n  },\n  \"include\": [\"src\", \"vite.config.ts\"]\n}"}]},{"type":"codeBlock","attrs":{"language":"typescript","filename":"vite.config.ts"},"content":[{"type":"text","text":"import react from \"@vitejs/plugin-react\";\nimport { defineConfig } from \"vite\";\n\nexport default defineConfig({\n  plugins: [react()],\n});"}]},{"type":"codeBlock","attrs":{"language":"html","filename":"index.html"},"content":[{"type":"text","text":"<!doctype html>\n<html lang=\"en\">\n  <head>\n    <meta charset=\"UTF-8\" />\n    <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\" />\n    <title>Pierogarnia · Kitchen admin</title>\n  </head>\n  <body>\n    <div id=\"root\"></div>\n    <script type=\"module\" src=\"/src/main.tsx\"></script>\n  </body>\n</html>"}]}]},{"type":"heading","attrs":{"level":2,"id":"step-2-design-tokens-and-the-theme"},"content":[{"type":"text","text":"Step 2. Design tokens and the theme"}]},{"type":"paragraph","content":[{"type":"text","text":"Design tokens","marks":[{"type":"bold"}]},{"type":"text","text":" are named decisions: \"brand colour 700\", \"medium radius\", \"sans-serif font\". The MUI theme is just one of their consumers – the same tokens can be exported to emails, charts or a mobile app."}]},{"type":"diagram","attrs":{"kind":"mermaid","code":"flowchart LR\n  T[\"tokens.ts<br/>brand, neutral, status, radius, font\"] --> C[\"createTheme()<br/>colorSchemes light/dark<br/>typography, shape, components\"]\n  C --> V[\"CSS variables<br/>--mui-palette-primary-main…\"]\n  V --> K[\"MUI components<br/>Button, Card, DataGrid\"]\n  V --> W[\"Your components<br/>styled(), sx\"]\n  A[\"mui.d.ts<br/>type augmentation\"] -.-> C\n  A -.-> W","caption":"From tokens to components: one source of decisions, no colours hard-coded in components"}},{"type":"paragraph","content":[{"type":"text","text":"Three theme files: the tokens, the type declarations (module augmentation) and the theme itself:"}]},{"type":"codeGroup","attrs":{"title":"Tokens, types and theme"},"content":[{"type":"codeBlock","attrs":{"language":"typescript","filename":"src/theme/tokens.ts"},"content":[{"type":"text","text":"// Design tokens: the single source of brand decisions. The MUI theme only maps them.\nexport const tokens = {\n  font: {\n    sans: '\"Inter Variable\", system-ui, -apple-system, \"Segoe UI\", sans-serif',\n  },\n  radius: { sm: 6, md: 10, lg: 14 },\n  // \"Beetroot\" brand scale instead of the default Material blue.\n  brand: { 50: \"#fff0f6\", 100: \"#ffdeeb\", 300: \"#faa2c1\", 500: \"#e64980\", 700: \"#c2255c\", 900: \"#a61e4d\" },\n  neutral: {\n    0: \"#ffffff\", 50: \"#f8f9fa\", 100: \"#f1f3f5\", 200: \"#e9ecef\", 300: \"#dee2e6\",\n    500: \"#868e96\", 700: \"#495057\", 800: \"#2b2f36\", 900: \"#1d2026\", 950: \"#141619\",\n  },\n  status: {\n    light: { placed: \"#1971c2\", cooking: \"#d9480f\", delivering: \"#6741d9\", delivered: \"#2b8a3e\", cancelled: \"#868e96\" },\n    dark: { placed: \"#74c0fc\", cooking: \"#ffa94d\", delivering: \"#b197fc\", delivered: \"#8ce99a\", cancelled: \"#adb5bd\" },\n  },\n} as const;\n\nexport type OrderStatus = keyof typeof tokens.status.light;"}]},{"type":"codeBlock","attrs":{"language":"typescript","filename":"src/theme/mui.d.ts"},"content":[{"type":"text","text":"import type { OrderStatus } from \"./tokens.ts\";\n\n// Module augmentation: teach MUI's types about our custom theme parts.\ndeclare module \"@mui/material/styles\" {\n  // We always enable CSS variables, so `theme.vars` is never undefined.\n  interface CssThemeVariables {\n    enabled: true;\n  }\n  interface Palette {\n    status: Record<OrderStatus, string>;\n  }\n  interface PaletteOptions {\n    status?: Record<OrderStatus, string>;\n  }\n}\n\ndeclare module \"@mui/material/Button\" {\n  interface ButtonPropsVariantOverrides {\n    soft: true;\n  }\n}"}]},{"type":"codeBlock","attrs":{"language":"typescript","filename":"src/theme/theme.ts"},"content":[{"type":"text","text":"import { createTheme } from \"@mui/material/styles\";\nimport { tokens } from \"./tokens.ts\";\n\nconst { brand, neutral, radius, status } = tokens;\n\nexport const theme = createTheme({\n  // CSS variables + a class on <html> switch light/dark without re-rendering React.\n  cssVariables: { colorSchemeSelector: \"class\" },\n  colorSchemes: {\n    light: {\n      palette: {\n        primary: { main: brand[700], light: brand[500], dark: brand[900], contrastText: \"#fff\" },\n        background: { default: neutral[50], paper: neutral[0] },\n        text: { primary: neutral[900], secondary: neutral[700] },\n        divider: neutral[200],\n        status: status.light,\n      },\n    },\n    dark: {\n      palette: {\n        primary: { main: brand[300], light: brand[100], dark: brand[500], contrastText: neutral[950] },\n        background: { default: neutral[950], paper: neutral[900] },\n        text: { primary: neutral[100], secondary: neutral[500] },\n        divider: \"rgba(255, 255, 255, 0.10)\",\n        status: status.dark,\n      },\n    },\n  },\n  shape: { borderRadius: radius.md },\n  typography: {\n    fontFamily: tokens.font.sans,\n    h1: { fontSize: \"1.75rem\", fontWeight: 700, letterSpacing: \"-0.02em\" },\n    h2: { fontSize: \"1.25rem\", fontWeight: 650, letterSpacing: \"-0.01em\" },\n    overline: { fontWeight: 600, letterSpacing: \"0.06em\" },\n    button: { textTransform: \"none\", fontWeight: 600 }, // no SHOUTING buttons\n  },\n  components: {\n    MuiButtonBase: { defaultProps: { disableRipple: true } },\n    MuiButton: {\n      defaultProps: { disableElevation: true },\n      styleOverrides: {\n        root: ({ theme }) => ({\n          borderRadius: radius.sm,\n          \"&.Mui-focusVisible\": { outline: `2px solid ${theme.vars.palette.primary.main}`, outlineOffset: 2 },\n          // Custom variant registered in mui.d.ts: <Button variant=\"soft\">\n          variants: [\n            {\n              props: { variant: \"soft\" },\n              style: {\n                color: theme.vars.palette.primary.main,\n                backgroundColor: theme.alpha(theme.vars.palette.primary.main, 0.12),\n                \"&:hover\": { backgroundColor: theme.alpha(theme.vars.palette.primary.main, 0.2) },\n              },\n            },\n          ],\n        }),\n      },\n    },\n    MuiPaper: { defaultProps: { elevation: 0 }, styleOverrides: { root: { backgroundImage: \"none\" } } },\n    MuiCard: { defaultProps: { variant: \"outlined\" } },\n    MuiAppBar: {\n      defaultProps: { elevation: 0, color: \"inherit\", position: \"sticky\" },\n      styleOverrides: { root: ({ theme }) => ({ borderBottom: `1px solid ${theme.vars.palette.divider}` }) },\n    },\n    MuiTextField: { defaultProps: { size: \"small\", fullWidth: true } },\n    MuiChip: { styleOverrides: { root: { fontWeight: 600, borderRadius: radius.sm } } },\n    MuiTooltip: { defaultProps: { arrow: true } },\n  },\n});"}]}]},{"type":"paragraph","content":[{"type":"text","text":"What's going on:"}]},{"type":"bulletList","content":[{"type":"listItem","content":[{"type":"paragraph","content":[{"type":"text","text":"cssVariables: { colorSchemeSelector: \"class\" }","marks":[{"type":"code"}]},{"type":"text","text":" – MUI generates CSS variables ("},{"type":"text","text":"--mui-palette-primary-main","marks":[{"type":"code"}]},{"type":"text","text":") and switches the scheme with a "},{"type":"text","text":".dark","marks":[{"type":"code"}]},{"type":"text","text":" class on "},{"type":"text","text":"<html>","marks":[{"type":"code"}]},{"type":"text","text":". Components reference the variables, so changing the mode is just a class change, with no React re-render."}]}]},{"type":"listItem","content":[{"type":"paragraph","content":[{"type":"text","text":"colorSchemes.light","marks":[{"type":"code"}]},{"type":"text","text":" / ","marks":[{"type":"bold"}]},{"type":"text","text":"colorSchemes.dark","marks":[{"type":"code"}]},{"type":"text","text":" – two palettes built from the same tokens. In dark mode the primary colour is lighter ("},{"type":"text","text":"brand[300]","marks":[{"type":"code"}]},{"type":"text","text":") to keep the contrast."}]}]},{"type":"listItem","content":[{"type":"paragraph","content":[{"type":"text","text":"theme.vars.palette…","marks":[{"type":"code"}]},{"type":"text","text":" in overrides instead of "},{"type":"text","text":"theme.palette…","marks":[{"type":"code"}]},{"type":"text","text":" – the CSS variable, not a fixed light-theme colour. Thanks to the "},{"type":"text","text":"CssThemeVariables { enabled: true }","marks":[{"type":"code"}]},{"type":"text","text":" augmentation TypeScript knows "},{"type":"text","text":"theme.vars","marks":[{"type":"code"}]},{"type":"text","text":" always exists."}]}]},{"type":"listItem","content":[{"type":"paragraph","content":[{"type":"text","text":"components","marks":[{"type":"code"}]},{"type":"text","text":" – default props and style overrides for every instance of a component. This is where shadows, ripples and upper-case labels disappear."}]}]},{"type":"listItem","content":[{"type":"paragraph","content":[{"type":"text","text":"A custom ","marks":[{"type":"bold"}]},{"type":"text","text":"soft","marks":[{"type":"code"}]},{"type":"text","text":" variant","marks":[{"type":"bold"}]},{"type":"text","text":" – register it in "},{"type":"text","text":"ButtonPropsVariantOverrides","marks":[{"type":"code"}]},{"type":"text","text":" and add its style in "},{"type":"text","text":"styleOverrides.root.variants","marks":[{"type":"code"}]},{"type":"text","text":". From then on "},{"type":"text","text":"<Button variant=\"soft\">","marks":[{"type":"code"}]},{"type":"text","text":" is typed and autocompleted."}]}]}]},{"type":"table","content":[{"type":"tableRow","content":[{"type":"tableHeader","attrs":{"colspan":1,"rowspan":1},"content":[{"type":"paragraph","content":[{"type":"text","text":"MUI default"}]}]},{"type":"tableHeader","attrs":{"colspan":1,"rowspan":1},"content":[{"type":"paragraph","content":[{"type":"text","text":"In this project"}]}]},{"type":"tableHeader","attrs":{"colspan":1,"rowspan":1},"content":[{"type":"paragraph","content":[{"type":"text","text":"Where"}]}]}]},{"type":"tableRow","content":[{"type":"tableCell","attrs":{"colspan":1,"rowspan":1},"content":[{"type":"paragraph","content":[{"type":"text","text":"blue "},{"type":"text","text":"#1976d2","marks":[{"type":"code"}]}]}]},{"type":"tableCell","attrs":{"colspan":1,"rowspan":1},"content":[{"type":"paragraph","content":[{"type":"text","text":"a \"beetroot\" brand scale from the tokens"}]}]},{"type":"tableCell","attrs":{"colspan":1,"rowspan":1},"content":[{"type":"paragraph","content":[{"type":"text","text":"colorSchemes.*.palette.primary","marks":[{"type":"code"}]}]}]}]},{"type":"tableRow","content":[{"type":"tableCell","attrs":{"colspan":1,"rowspan":1},"content":[{"type":"paragraph","content":[{"type":"text","text":"Roboto"}]}]},{"type":"tableCell","attrs":{"colspan":1,"rowspan":1},"content":[{"type":"paragraph","content":[{"type":"text","text":"Inter Variable via Fontsource"}]}]},{"type":"tableCell","attrs":{"colspan":1,"rowspan":1},"content":[{"type":"paragraph","content":[{"type":"text","text":"typography.fontFamily","marks":[{"type":"code"}]}]}]}]},{"type":"tableRow","content":[{"type":"tableCell","attrs":{"colspan":1,"rowspan":1},"content":[{"type":"paragraph","content":[{"type":"text","text":"upper-case "},{"type":"text","text":"BUTTON","marks":[{"type":"code"}]}]}]},{"type":"tableCell","attrs":{"colspan":1,"rowspan":1},"content":[{"type":"paragraph","content":[{"type":"text","text":"textTransform: \"none\"","marks":[{"type":"code"}]},{"type":"text","text":", weight 600"}]}]},{"type":"tableCell","attrs":{"colspan":1,"rowspan":1},"content":[{"type":"paragraph","content":[{"type":"text","text":"typography.button","marks":[{"type":"code"}]}]}]}]},{"type":"tableRow","content":[{"type":"tableCell","attrs":{"colspan":1,"rowspan":1},"content":[{"type":"paragraph","content":[{"type":"text","text":"shadows (elevation 1–24)"}]}]},{"type":"tableCell","attrs":{"colspan":1,"rowspan":1},"content":[{"type":"paragraph","content":[{"type":"text","text":"1 px borders, "},{"type":"text","text":"elevation: 0","marks":[{"type":"code"}]}]}]},{"type":"tableCell","attrs":{"colspan":1,"rowspan":1},"content":[{"type":"paragraph","content":[{"type":"text","text":"MuiPaper","marks":[{"type":"code"}]},{"type":"text","text":", "},{"type":"text","text":"MuiCard","marks":[{"type":"code"}]},{"type":"text","text":", "},{"type":"text","text":"MuiAppBar","marks":[{"type":"code"}]}]}]}]},{"type":"tableRow","content":[{"type":"tableCell","attrs":{"colspan":1,"rowspan":1},"content":[{"type":"paragraph","content":[{"type":"text","text":"ripple on click"}]}]},{"type":"tableCell","attrs":{"colspan":1,"rowspan":1},"content":[{"type":"paragraph","content":[{"type":"text","text":"a clear 2 px focus ring"}]}]},{"type":"tableCell","attrs":{"colspan":1,"rowspan":1},"content":[{"type":"paragraph","content":[{"type":"text","text":"MuiButtonBase","marks":[{"type":"code"}]},{"type":"text","text":", "},{"type":"text","text":"MuiButton","marks":[{"type":"code"}]}]}]}]},{"type":"tableRow","content":[{"type":"tableCell","attrs":{"colspan":1,"rowspan":1},"content":[{"type":"paragraph","content":[{"type":"text","text":"medium","marks":[{"type":"code"}]},{"type":"text","text":" inputs"}]}]},{"type":"tableCell","attrs":{"colspan":1,"rowspan":1},"content":[{"type":"paragraph","content":[{"type":"text","text":"small","marks":[{"type":"code"}]},{"type":"text","text":" inputs – a denser panel"}]}]},{"type":"tableCell","attrs":{"colspan":1,"rowspan":1},"content":[{"type":"paragraph","content":[{"type":"text","text":"MuiTextField.defaultProps","marks":[{"type":"code"}]}]}]}]}]},{"type":"heading","attrs":{"level":2,"id":"step-3-dark-mode-without-the-flash"},"content":[{"type":"text","text":"Step 3. Dark mode without the flash"}]},{"type":"paragraph","content":[{"type":"text","text":"With a CSS-variables theme, dark mode needs three things: "},{"type":"text","text":"ThemeProvider","marks":[{"type":"code"}]},{"type":"text","text":" with "},{"type":"text","text":"defaultMode","marks":[{"type":"code"}]},{"type":"text","text":", "},{"type":"text","text":"CssBaseline enableColorScheme","marks":[{"type":"code"}]},{"type":"text","text":" (scrollbars and native inputs go dark too) and a switch built on "},{"type":"text","text":"useColorScheme()","marks":[{"type":"code"}]},{"type":"text","text":"."}]},{"type":"codeGroup","attrs":{"title":"Colour scheme switch"},"content":[{"type":"codeBlock","attrs":{"language":"typescript","filename":"src/components/ThemeModeToggle.tsx"},"content":[{"type":"text","text":"import DarkModeOutlined from \"@mui/icons-material/DarkModeOutlined\";\nimport LightModeOutlined from \"@mui/icons-material/LightModeOutlined\";\nimport SettingsBrightnessOutlined from \"@mui/icons-material/SettingsBrightnessOutlined\";\nimport ToggleButton from \"@mui/material/ToggleButton\";\nimport ToggleButtonGroup from \"@mui/material/ToggleButtonGroup\";\nimport { useColorScheme } from \"@mui/material/styles\";\n\nexport function ThemeModeToggle() {\n  const { mode, setMode } = useColorScheme(); // \"light\" | \"dark\" | \"system\", persisted in localStorage\n  if (!mode) return null; // not resolved yet on the very first render\n\n  return (\n    <ToggleButtonGroup\n      size=\"small\"\n      exclusive\n      value={mode}\n      onChange={(_, next: typeof mode | null) => next && setMode(next)}\n      aria-label=\"Colour scheme\"\n    >\n      <ToggleButton value=\"light\" aria-label=\"Light\">\n        <LightModeOutlined fontSize=\"small\" />\n      </ToggleButton>\n      <ToggleButton value=\"system\" aria-label=\"System\">\n        <SettingsBrightnessOutlined fontSize=\"small\" />\n      </ToggleButton>\n      <ToggleButton value=\"dark\" aria-label=\"Dark\">\n        <DarkModeOutlined fontSize=\"small\" />\n      </ToggleButton>\n    </ToggleButtonGroup>\n  );\n}"}]}]}]},"toc":[{"id":"step-1-installation","text":"Step 1. Installation","level":2,"locked":false},{"id":"step-2-design-tokens-and-the-theme","text":"Step 2. Design tokens and the theme","level":2,"locked":false},{"id":"step-3-dark-mode-without-the-flash","text":"Step 3. Dark mode without the flash","level":2,"locked":false},{"id":"step-4-custom-components-styled-sx-and-a-status-palette","text":"Step 4. Custom components: styled, sx and a status palette","level":2,"locked":true},{"id":"step-5-datagrid-client-side-and-server-side-tables","text":"Step 5. DataGrid: client-side and server-side tables","level":2,"locked":true},{"id":"step-6-a-form-react-hook-form-mui-components","text":"Step 6. A form: react-hook-form + MUI components","level":2,"locked":true},{"id":"step-7-putting-the-panel-together","text":"Step 7. Putting the panel together","level":2,"locked":true},{"id":"avoiding-the-default-material-look-a-checklist","text":"Avoiding the \"default Material\" look – a checklist","level":2,"locked":true},{"id":"common-mistakes","text":"Common mistakes","level":2,"locked":true},{"id":"check-yourself","text":"Check yourself","level":2,"locked":true},{"id":"what-next","text":"What next","level":2,"locked":true}],"locked":true,"paywall":null,"previewRatio":0.3,"totalBlocks":57,"visibleBlocks":20,"resources":[{"id":"6b0857b53c96f2d34d0b39a6","type":"article","provider":"web","url":"https://martinfowler.com/articles/design-token-based-ui-architecture.html","embedUrl":null,"title":"Design Token-Based UI Architecture","description":"Describing established patterns for organizing design tokens and practical approaches for automation","author":"martinfowler.com","thumbnailUrl":"https://martinfowler.com/articles/design-token-based-ui-architecture/card.png","durationSec":null,"lang":"en","topics":[],"techs":["general"],"tags":["software-architecture","hacker-news"],"price":"free","featured":false,"featuredOrder":0,"packageName":null,"source":"hn","publishedAt":"2024-12-17T22:04:26.000Z","popularity":65,"verifiedAt":"2026-11-26T11:19:38.000Z","curated":false,"addedBy":"6b0857a15a2625e44ecaabe6","createdAt":"2026-11-26T16:00:52.228Z","updatedAt":"2026-11-26T16:00:52.228Z"},{"id":"6b0857cc3c96f2d34d0b4cd9","type":"video","provider":"youtube","url":"https://www.youtube.com/watch?v=XcI81nVWmWU","embedUrl":"https://www.youtube-nocookie.com/embed/XcI81nVWmWU","title":"Design systems for every user including people and LLMs | ODSP916","description":"Accessibility is often viewed as a usability feature or compliance requirement, important but secondary. In AI‑driven systems, that no longer holds. LLMs interpret the content we produce, and their reliability depends on structure, semantics, and clarity. Accessible content is easier for humans…","author":"Microsoft Developer","thumbnailUrl":"https://i.ytimg.com/vi/XcI81nVWmWU/hqdefault.jpg","durationSec":null,"lang":"en","topics":[],"techs":["general"],"tags":["llm","ai"],"price":"free","featured":false,"featuredOrder":0,"packageName":null,"source":"youtube-rss","publishedAt":"2026-06-03T10:44:45.000Z","popularity":36,"verifiedAt":"2026-11-26T10:56:19.000Z","curated":false,"addedBy":"6b0857a15a2625e44ecaabe6","createdAt":"2026-11-26T16:01:15.892Z","updatedAt":"2026-11-26T16:01:15.892Z"},{"id":"6b0857b23c96f2d34d0b35c8","type":"repo","provider":"github","url":"https://github.com/danilowoz/react-atomic-design","embedUrl":null,"title":"danilowoz/react-atomic-design","description":"🔬 How the Atomic Design methodology can create a great design system from scratch and make better developers.","author":"danilowoz","thumbnailUrl":"https://opengraph.githubassets.com/1/danilowoz/react-atomic-design","durationSec":null,"lang":"en","topics":[],"techs":["javascript"],"tags":["atomic-css","atomic-design","boilerplate","css-architecture","css-modules","design-patterns","software-architecture","flowtype","react","storybook"],"price":"free","featured":false,"featuredOrder":0,"packageName":null,"source":"github","publishedAt":"2017-11-05T17:19:08.000Z","popularity":63,"verifiedAt":"2026-11-26T10:57:25.000Z","curated":false,"addedBy":"6b0857a15a2625e44ecaabe6","createdAt":"2026-11-26T16:00:50.215Z","updatedAt":"2026-11-26T16:00:50.215Z"},{"id":"6b0857c53c96f2d34d0b479b","type":"book","provider":"openlibrary","url":"https://openlibrary.org/works/OL24207531W","embedUrl":null,"title":"React Design Patterns and Best Practices","description":"","author":"Carlos Santana Roldan","thumbnailUrl":"https://covers.openlibrary.org/b/id/10653332-L.jpg","durationSec":null,"lang":"en","topics":[],"techs":["javascript"],"tags":["book","design-patterns"],"price":"paid","featured":false,"featuredOrder":0,"packageName":null,"source":"openlibrary","publishedAt":"2019-01-01T00:00:00.000Z","popularity":24,"verifiedAt":"2026-11-26T11:00:08.000Z","curated":false,"addedBy":"6b0857a15a2625e44ecaabe6","createdAt":"2026-11-26T16:01:07.480Z","updatedAt":"2026-11-26T16:01:07.480Z"}],"challenges":[],"attachments":[],"hasCode":true,"repoUrl":null,"series":[],"prev":null,"next":null,"featured":false,"authorCard":{"id":"6b08bd2e80884893657cc8cf","name":"Redakcja Art of Devs","avatar":null,"handle":"redakcja","headline":"Wzorce projektowe · Architektura · AI i LLM","community":false,"reputation":{"points":3900,"level":{"key":"mentor","label":"Mentor"}},"articles":68,"skills":[{"key":"typescript","title":"TypeScript","level":5,"levelLabel":"Authority","articles":63},{"key":"dotnet","title":".NET","level":5,"levelLabel":"Authority","articles":53},{"key":"python","title":"Python","level":5,"levelLabel":"Authority","articles":52},{"key":"java","title":"Java","level":5,"levelLabel":"Authority","articles":38}]}}