Implement Material UI (MUI) components following project-specific rules with optional documentation fetching for complex components. Use when implementing MUI components in React/TypeScript, especially for complex components (Table, Autocomplete, Stepper, Data Grid, Menu, Dialog, Tabs, Select with advanced features), or when user explicitly requests MUI documentation. Always uses deep imports, System Props, and MUI layout components (Box/Stack) per project standards.
Implement Material UI components following project rules with optional MUI documentation fetching via MCP server.
When user requests a MUI component, assess its complexity:
Always read complex-components.md first to check if the component is complex.
High Complexity (Table, Autocomplete, Stepper, Menu, Data Grid, Date/Time Picker):
Medium/Low Complexity (Button, TextField, Card, Stack, etc.):
User explicitly requests docs:
When docs fetching is confirmed:
Read MCP tools available: Check C:\Users\NC\.cursor\projects\d-Code-e-notarization-web-frontend\mcps\cursor-browser-extension\tools\ for available MUI MCP tools
Call useMuiDocs: Fetch docs for the specific component
// Example: For Table component
CallMcpTool('cursor-browser-extension', 'useMuiDocs', {
package: '@mui/material/Table'
})
Call fetchDocs if needed: If additional docs URLs are present in returned content
CallMcpTool('cursor-browser-extension', 'fetchDocs', {
url: 'https://mui.com/material-ui/...'
})
Repeat: Continue fetching until all relevant docs are loaded
Always read project-rules.md first before implementing.
Follow these mandatory rules:
// ✅ DO
import Button from '@mui/material/Button'
import Box from '@mui/material/Box'
import Stack from '@mui/material/Stack'
// ❌ DON'T
import { Button, Box, Stack } from '@mui/material'
// ✅ DO - Use Box/Stack
<Box p={2}>
<Stack spacing={1}>
<Button>Action</Button>
</Stack>
</Box>
// ❌ DON'T - Use HTML tags
<div style={{ padding: '16px' }}>
<div style={{ display: 'flex', gap: '8px' }}>
<button>Action</button>
</div>
</div>
// ✅ DO - Use System Props
<Box p={2} m={1} bgcolor="primary.main" borderRadius={2}>
// ❌ DON'T - Use inline styles
<div style={{ padding: '16px', margin: '8px' }}>
// ✅ DO
<TextField label="Username" />
<TextField label="Description" multiline rows={4} />
// ❌ DON'T
<Input />
<textarea />
When implementing with fetched docs:
User: "Create a login form with MUI"
Action:
import Box from '@mui/material/Box'
import Stack from '@mui/material/Stack'
import TextField from '@mui/material/TextField'
import Button from '@mui/material/Button'
import Typography from '@mui/material/Typography'
const LoginForm: React.FC = () => {
return (
<Box component="form" p={3}>
<Stack spacing={3}>
<Typography variant="h4">Login</Typography>
<TextField label="Username" fullWidth />
<TextField label="Password" type="password" fullWidth />
<Button variant="contained" type="submit" fullWidth>
Sign In
</Button>
</Stack>
</Box>
)
}
User: "Create a data table with sorting and pagination"
Action:
User: "Create an Autocomplete, fetch the docs to be sure"
Action:
When to ask about docs:
When to skip docs:
Always apply:
import Button from '@mui/material/Button'