Rules Hub
Coding Rules Library
Rule priority, scope & exceptions
Use this to align rules with the senior-level structure (P0/P1/P2, scope, exceptions/tradeoffs).
Migrate deprecated MUI flat slot props to the unified `slotProps` API
Replace deprecated MUI props like `inputProps`/`PaperProps`/`PopperProps`/`MenuListProps`/`FormHelperTextProps` with the corresponding `slotProps` entries.
Bad example
| 1 | <TextField inputProps={{ maxLength: 280 }} /> |
| 2 | <Menu MenuListProps={{ disablePadding: true }} /> |
| 3 | <Tooltip PopperProps={{ modifiers }} /> |
Explanation (EN)
These flat per-slot props are deprecated in recent MUI versions and emit warnings; they are inconsistent across components.
Objašnjenje (HR)
Ovi ravni propovi po slotu su zastarjeli u novijim verzijama MUI-a i ispisuju upozorenja; nedosljedni su medu komponentama.
Good example
| 1 | <TextField slotProps={{ input: { maxLength: 280 } }} /> |
| 2 | <Menu slotProps={{ list: { disablePadding: true } }} /> |
| 3 | <Tooltip slotProps={{ popper: { modifiers } }} /> |
Explanation (EN)
The unified `slotProps` API targets each slot by name and is the supported, forward-compatible way to customize MUI internals.
Objašnjenje (HR)
Unificirani `slotProps` API cilja svaki slot po imenu i predstavlja podrzani, unaprijed kompatibilan nacin prilagodbe MUI internih elemenata.
Exceptions / Tradeoffs (EN)
When wrapping a MUI component and forwarding a consumer-provided deprecated prop, also destructure and remap it (e.g. `PaperProps`) into `slotProps.paper` rather than leaving the deprecated prop on the API.
Iznimke / Tradeoffi (HR)
Kada omotavas MUI komponentu i prosljedujes zastarjeli prop koji daje korisnik, takoder ga destrukturiraj i premapiraj (npr. `PaperProps`) u `slotProps.paper` umjesto da ostavis zastarjeli prop u API-ju.