一键导入
mui
Material UI components with theming and sx prop. Trigger: When using MUI components, implementing theming, or creating custom components.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Material UI components with theming and sx prop. Trigger: When using MUI components, implementing theming, or creating custom components.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Paste-ready session summary for context transfer to a new chat. Trigger: User says 'context handoff', 'start fresh', or session needs to continue.
One-at-a-time questioning to fully profile a goal before acting. Trigger: User says 'grill me', goal is vague, or clarification is needed first.
Batch execution with checkpoints. Trigger: When executing plans with batched tasks.
Universal coding principles: DRY, security by default, null guards, and YAGNI. Trigger: When writing or reviewing code in any language or technology.
Accessibility guide (WCAG 2.1/2.2, Level A–AAA). Trigger: When building UI components, interactive elements, or auditing accessibility compliance.
Astro quality patterns: island philosophy, SEO by page type, and Core Web Vitals. Trigger: When reviewing Astro site quality or hydration decisions.
| name | mui |
| description | Material UI components with theming and sx prop. Trigger: When using MUI components, implementing theming, or creating custom components. |
| license | Apache 2.0 |
| metadata | {"version":"1.1","type":"library","skills":["react"],"dependencies":{"@mui/material":">=5.0.0 <6.0.0","@mui/x-charts":">=6.0.0 <8.0.0","react":">=17.0.0 <19.0.0"}} |
Material UI for React with theming, sx prop, and accessibility patterns for v5+.
Don't use for:
| Component library patterns | ✅ Yes | ✅ Yes | components.md (required) | | Theme customization / dark mode | ✅ Yes | ✅ Yes | theming.md (required) | | Advanced styling (sx, styled API) | ✅ Yes | ✅ Yes | customization.md (required) | | Tables, DataGrid, Lists | ✅ Yes | ✅ Yes | data-display.md (required) | | Form validation, Select, Autocomplete | ✅ Yes | ✅ Yes | forms.md (required) | | Multiple advanced features | ✅ Yes | ✅ Yes | All relevant references |
All reference files located in skills/mui/references/:
1. User: "Dark mode with custom palette"
2. Read: SKILL.md
3. Decision Tree: "Dark mode? → theming.md"
4. Read: theming.md
5. Execute: createTheme + ThemeProvider
Use when:
Don't use for:
// ✅ CORRECT: Wrap app with ThemeProvider
import { ThemeProvider, createTheme } from '@mui/material';
const theme = createTheme({ /* config */ });
<ThemeProvider theme={theme}>
<App />
</ThemeProvider>
// ❌ WRONG: Using MUI without theme (inconsistent styling)
<App /> // No ThemeProvider
// ✅ CORRECT: sx prop with theme values
<Box sx={{ p: 2, bgcolor: 'primary.main' }}>
// ❌ WRONG: Inline styles (loses theme consistency)
<Box style={{ padding: '16px', backgroundColor: '#1976d2' }}>
// ✅ CORRECT: MUI components with built-in accessibility
<Button variant="contained" onClick={handleClick}>Submit</Button>
// ❌ WRONG: Custom HTML without accessibility
<div className="button" onClick={handleClick}>Submit</div>
One-off styling?
→ sx prop with theme values: sx={{ p: 2, bgcolor: 'primary.main' }}
Reusable styled component?
→ styled() API — see customization.md for styled API patterns
Global theme change?
→ Configure in createTheme(), apply via ThemeProvider — see theming.md for theme setup
Need custom variant?
→ Extend theme with component variants in theme configuration — see customization.md for variant patterns
Responsive styling?
→ Theme breakpoints: sx={{ p: { xs: 1, md: 2 } }} or theme.breakpoints.up('md')
Dark mode?
→ Create separate light/dark themes, toggle via ThemeProvider — see theming.md for dark mode implementation
Custom component?
→ Extend MUI component with styled API or composition pattern — see components.md for component patterns
Building forms?
→ TextField, Select, Autocomplete with validation — see forms.md for form patterns
Displaying tables/lists?
→ Table, DataGrid, List components — see data-display.md for data display patterns
import { Button, Box, ThemeProvider, createTheme } from '@mui/material';
const theme = createTheme({
palette: {
primary: {
main: '#1976d2',
},
},
});
<ThemeProvider theme={theme}>
<Box sx={{ p: 2 }}>
<Button variant="contained" color="primary">
Click Me
</Button>
</Box>
</ThemeProvider>
Theme nesting: Nested ThemeProviders merge; use for component overrides.
SSR styling: Use ServerStyleSheets to prevent FOUC.
Custom breakpoints: createTheme({ breakpoints: { values: { mobile: 0, tablet: 640 } } }).
sx performance: Frequent re-renders → use styled() over sx.
Icon sizing: Use fontSize prop for consistency.