---
name: mantine-reviewing
description: Review React components using Mantine UI library for accessibility, Styles API correctness, component patterns, and common pitfalls. Use when reviewing Mantine code or before merging Mantine-based PRs.
version: 1.0.0
---
# Mantine Code Review
## Purpose
Review React components using Mantine UI library for accessibility compliance, Styles API correctness, component pattern adherence, and common pitfall detection.
## When NOT to Use
- Non-Mantine React components (use general React review)
- Backend code review
- Mantine v6 or earlier (patterns differ)
- Initial development (use `mantine-developing` skill instead)
## Review Workflow
### Step 1: Identify Mantine Files
```bash
# Find files using Mantine
grep -r "from '@mantine" --include="*.tsx" --include="*.ts" -l
```
### Step 2: Run Automated Checks
```bash
# TypeScript errors
npm run typecheck
# Lint issues
npm run lint
# Check for common issues
grep -rn "disabled.*Tooltip\|Tooltip.*disabled" --include="*.tsx"
grep -rn "Accordion\.Control.*Button\|Button.*Accordion\.Control" --include="*.tsx"
grep -rn "ActionIcon[^>]*>" --include="*.tsx" | grep -v "aria-label"
```
### Step 3: Manual Review
Use CHECKLIST.md for comprehensive review criteria.
### Step 4: Report Findings
Format findings by severity:
- **CRITICAL**: Accessibility violations, invalid HTML
- **HIGH**: Performance issues, incorrect patterns
- **MEDIUM**: Style issues, suboptimal approaches
- **LOW**: Minor improvements, suggestions
## Critical Review Areas
### 1. Accessibility (CRITICAL)
**Must check:**
```tsx
// ❌ FAIL: Missing aria-label on icon button
// ✅ PASS: Has aria-label
```
**Review for:**
- All `ActionIcon` components have `aria-label`
- All `CloseButton` have `aria-label` or parent has `closeButtonLabel`
- Heading hierarchy correct (`order` prop on Accordion)
- Focus states visible (not removed by custom CSS)
- Keyboard navigation works
### 2. Nested Interactive Elements (CRITICAL)
**Invalid HTML - browsers will break layout:**
```tsx
// ❌ FAIL: Button inside button (Accordion.Control is a button)
Click here
// ✅ PASS: Button outside Control
Click here
```
**Check all:**
- `Accordion.Control` has no Button, ActionIcon, or Link children
- `Button` has no interactive children
- `UnstyledButton` has no interactive children
### 3. Styles API Usage (HIGH)
**Check for anti-patterns:**
```tsx
// ❌ FAIL: Inline style only affects root
// ❌ FAIL: !important hack
.my-button span { color: red !important; }
// ✅ PASS: Correct Styles API usage
```
**Review for:**
- Using `classNames` or `styles` prop for inner elements
- No `!important` in CSS targeting Mantine components
- Correct selector names (check component's Styles API docs)
- CSS variables used appropriately
### 4. Tooltip on Disabled (HIGH)
**Tooltip won't show on truly disabled elements:**
```tsx
// ❌ FAIL: Tooltip invisible
// ✅ PASS: Use data-disabled
```
### 5. ActionIcon.Group Structure (HIGH)
**Direct children only:**
```tsx
// ❌ FAIL: Wrapped children break styling
// ✅ PASS: Direct ActionIcon children
```
### 6. Select vs Autocomplete (MEDIUM)
```tsx
// When value MUST be from list → Select
// When free text is acceptable → Autocomplete
```
**Review for correct component choice based on requirements.**
### 7. Form Handling (MEDIUM)
**Prefer @mantine/form over manual state:**
```tsx
// ❌ Suboptimal: Manual state for each field
const [email, setEmail] = useState('');
const [password, setPassword] = useState('');
// ✅ Better: useForm hook
const form = useForm({
initialValues: { email: '', password: '' },
validate: { email: (v) => ... }
});
```
**Review for:**
- Using `useForm` for forms with validation
- Using `getInputProps` for input binding
- Correct `type: 'checkbox'` for checkbox/switch inputs
- Validation configured appropriately
### 8. Dark Mode Compatibility (MEDIUM)
```tsx
// ❌ FAIL: Hardcoded colors break dark mode
// ✅ PASS: Theme-aware colors
// ✅ PASS: Theme color references
```
### 9. Performance (MEDIUM)
**Check for:**
- Unnecessary re-renders from inline objects/functions
- Missing `useMemo`/`useCallback` for expensive operations
- Large lists without virtualization
- Heavy components not code-split
```tsx
// ❌ FAIL: New object every render