mui
Material UI — accessible React + Material Design; official MCP.
SKILL.mdskills/ui-libraries/mui/SKILL.md
GitHubDetection Signals
@mui/materialinpackage.json@emotion/reactand@emotion/styleddependenciesThemeProvider,createThemeimports in codebaseCssBaselinecomponent at app rootsxprop usage on components
MCP Setup
MUI has an official MCP server for component docs, prop references, examples, and theming.
Add to .claude/settings.json:
{
"mcpServers": {
"mui": {
"command": "npx",
"args": ["-y", "@mui/mcp@latest"]
}
}
}
If auto-configuration fails, ask the user to add the entry manually in their CLI's MCP settings (Claude Code → Settings → MCP Servers, the
mcpblock ofopencode.json, or Codex CLI's MCP config). The MCP provides real-time component API access without leaving the editor.
Core Concepts
| Concept | Detail |
|---|---|
| ThemeProvider | Wraps the app; all components read theme tokens from it |
sx prop |
Inline styling via theme tokens — preferred over style or CSS classes |
createTheme() |
Extends/overrides Material Design defaults |
| Emotion | CSS-in-JS engine used internally — don't mix with other CSS-in-JS libs |
| Breakpoints | xs (0px), sm (600px), md (900px), lg (1200px), xl (1536px) |
useTheme() |
Access theme tokens inside component logic |
Component Patterns
// sx prop — use theme tokens, not raw values
<Box sx={{ p: 2, bgcolor: 'background.paper', borderRadius: 1 }}>
// Responsive values via sx
<Typography sx={{ fontSize: { xs: '1rem', md: '1.25rem' } }} />
// Theme extension — brand decisions belong here, not in CSS files
const theme = createTheme({
palette: { primary: { main: '#1976d2' } },
typography: { fontFamily: '"Inter", sans-serif' },
})
// Grid2 (v5+) — the deprecated Grid has been replaced
import Grid from '@mui/material/Grid2'
<Grid container spacing={2}>
<Grid size={6}><Item /></Grid>
</Grid>
Critical Rules
- ThemeProvider is mandatory at app root — components without it fall back to defaults and look inconsistent
- Use
sxoverstyle—sxresolves theme tokens, breakpoints, and pseudo-selectors;styledoes not - Extend via
createTheme()— put all brand decisions there, not in global CSS overrides - Use
Grid2(not the legacyGrid) in MUI v5+ - Check MUI version before writing code — v5 and v6 have significant API differences; look at
package.json - Never mix Emotion with other CSS-in-JS — style conflicts are hard to debug and runtime cost doubles