materialui
A guide for using Material UI v6 for consistent and accessible React UI development.
Install
mkdir -p .claude/skills/materialui && curl -L -o skill.zip "https://agentskills.codes/api/skills/download/17051" && unzip -o skill.zip -d .claude/skills/materialui && rm skill.zipInstalls to .claude/skills/materialui
Activation
This is the description your AI agent reads to decide when to run this skill — the better it matches your request, the more reliably it fires.
Material UI React component library. Use for React UI.Key capabilities
- →Build enterprise-grade React UIs
- →Utilize Pigment CSS for RSC compatibility
- →Implement complex data grids with MUI X
- →Apply global design tokens with Theme Provider
- →Customize components using Slots/SlotProps
- →Ensure accessibility in React applications
How it works
This skill guides the use of Material UI (MUI) for React development, emphasizing Pigment CSS for React Server Components compatibility, the `sx` prop for styling, and `MUI X` for data components. It also covers Theme Provider for global design tokens and Slots/SlotProps for customization.
Inputs & outputs
When to use materialui
- →Build enterprise UI components
- →Implement MUI data grids
- →Configure UI theme provider
- →Design accessible React forms
About this skill
Material UI (MUI)
MUI Core (v6) is the gold standard for React UI. v6 introduces Pigment CSS (Zero-runtime CSS-in-JS) for compatibility with React Server Components (Next.js App Router).
When to Use
- Enterprise React Design Systems: Implementing Google's Material Design guidelines with battle-tested React components.
- Complex Administrative Portals: Utilizing advanced Data Grid, Date Pickers, and Tree View components.
- Custom Theming & Design Tokens: Building accessible, branded design systems via
createThemeand CSS variables. - Rapid Dashboard Prototyping: Developing polished responsive dashboards with minimal custom CSS.
Quick Start
import * as React from "react";
import {
Button,
Container,
Typography,
Card,
CardContent,
} from "@mui/material";
export default function MuiDemo() {
return (
<Container maxWidth="sm" sx={{ py: 4 }}>
<Card elevation={3}>
<CardContent>
<Typography variant="h5" component="div" gutterBottom>
Material UI Card
</Typography>
<Typography color="text.secondary" paragraph>
Pre-styled component adhering to Material Design 3.
</Typography>
<Button variant="contained" color="primary">
Primary Action
</Button>
</CardContent>
</Card>
</Container>
);
}
Core Concepts
Theme Customization & CSS Theme Variables
Configuring design tokens and light/dark color schemes with MUI:
import { createTheme, ThemeProvider, CssBaseline } from "@mui/material";
const theme = createTheme({
cssVariables: true, // Enables native CSS variables
colorSchemes: {
light: {
palette: {
primary: { main: "#2563eb" },
secondary: { main: "#475569" },
},
},
dark: {
palette: {
primary: { main: "#60a5fa" },
secondary: { main: "#94a3b8" },
},
},
},
typography: {
fontFamily: '"Inter", "Roboto", "Helvetica", sans-serif',
},
});
export function AppThemeProvider({ children }: { children: React.ReactNode }) {
return (
<ThemeProvider theme={theme}>
<CssBaseline />
{children}
</ThemeProvider>
);
}
The SX Prop & Dynamic System Styling
Applying theme-aware styles directly to components:
import { Box, Typography, Button, Stack } from "@mui/material";
export function StatCard({ label, value }: { label: string; value: string }) {
return (
<Box
sx={{
p: 3,
bgcolor: "background.paper",
borderRadius: 2,
boxShadow: 1,
border: "1px solid",
borderColor: "divider",
transition: "transform 0.2s, box-shadow 0.2s",
"&:hover": {
transform: "translateY(-2px)",
boxShadow: 3,
},
}}
>
<Typography variant="body2" color="text.secondary">
{label}
</Typography>
<Typography variant="h4" fontWeight="bold" sx={{ mt: 1 }}>
{value}
</Typography>
</Box>
);
}
Accessible Form Controls & Dialog Composition
Building composable modal workflows with focus trap:
import {
Dialog,
DialogTitle,
DialogContent,
DialogActions,
TextField,
Button,
} from "@mui/material";
import { useState } from "react";
export function EditDialog({
open,
onClose,
}: {
open: boolean;
onClose: () => void;
}) {
const [name, setName] = useState("");
return (
<Dialog open={open} onClose={onClose} fullWidth maxWidth="sm">
<DialogTitle>Update Profile</DialogTitle>
<DialogContent>
<TextField
autoFocus
margin="dense"
label="Full Name"
type="text"
fullWidth
variant="outlined"
value={name}
onChange={(e) => setName(e.target.value)}
/>
</DialogContent>
<DialogActions>
<Button onClick={onClose}>Cancel</Button>
<Button variant="contained" onClick={onClose}>
Save
</Button>
</DialogActions>
</Dialog>
);
}
Common Patterns
Custom Theme Provider with Global Style Overrides
Problem: Overriding MUI typography and component defaults across an entire application without repetitive sx props.
Solution:
Use createTheme with component default props:
import { createTheme, ThemeProvider } from "@mui/material/styles";
const theme = createTheme({
palette: {
primary: { main: "#1976d2" },
secondary: { main: "#dc004e" },
},
components: {
MuiButton: {
defaultProps: { disableElevation: true },
styleOverrides: {
root: { textTransform: "none", borderRadius: 8 },
},
},
},
});
// Wrap app: <ThemeProvider theme={theme}><App /></ThemeProvider>
Best Practices
Do:
- Enable
cssVariables: trueincreateThemeto prevent SSR dark-mode flicker. - Import icons using path imports (
import AddIcon from '@mui/icons-material/Add') to reduce bundle size. - Use MUI Joy UI or MUI Base UI for unstyled / modern non-Material design requirements.
- Wrap inputs with
FormControl,InputLabel, andFormHelperTextfor accessibility.
Don't:
- Use inline style objects (
style={{...}}); use the theme-awaresxprop. - Override MUI internal classnames (
.MuiButton-root) directly; use theme overrides orsx. - Nest multiple
ThemeProviderinstances without inheritance.
Troubleshooting
| Error | Cause | Solution |
|---|---|---|
TypeError: Cannot read properties of undefined (reading 'spacing') | Component rendered outside <ThemeProvider>. | Ensure root app is wrapped in <ThemeProvider theme={theme}>. |
MUI: The value provided to Autocomplete is invalid | Value object reference does not match any item in options array. | Implement isOptionEqualToValue={(option, value) => option.id === value.id}. |
CSS specificity clash with Tailwind / emotion | Order of CSS injection causes rules to be overridden. | Configure Emotion StyledEngineProvider with injectFirst. |
References
When not to use it
- →When `makeStyles` is preferred for styling
Limitations
- →The skill does not cover `makeStyles` as it is deprecated.
How it compares
This workflow focuses on modern MUI v6 practices, including Pigment CSS and `MUI X`, providing a structured approach to building enterprise-level React UIs with accessibility and performance considerations, unlike using older MUI versions o
Compared to similar skills
materialui side by side with the closest alternatives in the catalog.
| Skill | Installs | Updated | Safety | Difficulty |
|---|---|---|---|---|
| materialui (this skill) | 0 | 7mo | No flags | Intermediate |
| ui-ux-pro-max | 1,909 | 6mo | Review | Intermediate |
| scroll-experience | 101 | 8mo | No flags | Intermediate |
| ui-styling | 12 | 11mo | Review | Beginner |
Try saying
Example prompts that trigger this skill in your AI assistant.
More by G1Joshi
View all by G1Joshi →You might also like
ui-ux-pro-max
nextlevelbuilder
UI/UX design intelligence. 50 styles, 21 palettes, 50 font pairings, 20 charts, 8 stacks (React, Next.js, Vue, Svelte, SwiftUI, React Native, Flutter, Tailwind). Actions: plan, build, create, design, implement, review, fix, improve, optimize, enhance, refactor, check UI/UX code. Projects: website, landing page, dashboard, admin panel, e-commerce, SaaS, portfolio, blog, mobile app, .html, .tsx, .vue, .svelte. Elements: button, modal, navbar, sidebar, card, table, form, chart. Styles: glassmorphism, claymorphism, minimalism, brutalism, neumorphism, bento grid, dark mode, responsive, skeuomorphism, flat design. Topics: color palette, accessibility, animation, layout, typography, font pairing, spacing, hover, shadow, gradient.
scroll-experience
davila7
Expert in building immersive scroll-driven experiences - parallax storytelling, scroll animations, interactive narratives, and cinematic web experiences. Like NY Times interactives, Apple product pages, and award-winning web experiences. Makes websites feel like experiences, not just pages. Use when: scroll animation, parallax, scroll storytelling, interactive story, cinematic website.
ui-styling
mrgoonie
Create beautiful, accessible user interfaces with shadcn/ui components (built on Radix UI + Tailwind), Tailwind CSS utility-first styling, and canvas-based visual designs. Use when building user interfaces, implementing design systems, creating responsive layouts, adding accessible components (dialogs, dropdowns, forms, tables), customizing themes and colors, implementing dark mode, generating visual designs and posters, or establishing consistent styling patterns across applications.
elegant-design
rand
Create world-class, accessible, responsive interfaces with sophisticated interactive elements including chat, terminals, code display, and streaming content. Use when building user interfaces that need professional polish and developer-focused features.
figma
openai
Use the Figma MCP server to fetch design context, screenshots, variables, and assets from Figma, and to translate Figma nodes into production code. Trigger when a task involves Figma URLs, node IDs, design-to-code implementation, or Figma MCP setup and troubleshooting.
interaction-design
wshobson
Design and implement microinteractions, motion design, transitions, and user feedback patterns. Use when adding polish to UI interactions, implementing loading states, or creating delightful user experiences.