Repository navigation
Conversation
The API pages showed a rule name for each class that is not a global state class. Some of these names are not theme `styleOverrides` keys, so the types reject them and the runtime ignores them. - The API docs builder reads `ComponentNameToClassKey` and `Components` from the project exports. It marks a class with `isStyleOverridesKey: false` when the theme of the class owner does not accept the key. - The API page hides the rule name of a marked class. When no class has a rule name, it also hides the rule name column and the `styleOverrides` hint. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Deploy previewhttps://deploy-preview-49778--material-ui.netlify.app/Bundle size
PerformanceNo regressions in 32 benchmarks · precise to ±5.1% (±9.4% at worst) · ran 2m 09s · details Check out the code infra dashboard for more information about this PR. |
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues were identified for the API documentation changes to displayed theme override keys.
No open issues 🎉
What changed in this PR
Updates API documentation generation and rendering so CSS classes are not advertised as theme styleOverrides keys when the theme types reject them. This supports components such as Menu2 while preserving inherited class ownership.
Changes:
- Detect unsupported rule names from theme type exports and mark them in generated class metadata.
- Hide marked rule names in table and list views, and hide the column and theme hint when no rule names remain.
- Add parser coverage for excluded keys, default-props-only components, inherited classes, and unregistered components.
| File | Description |
|---|---|
| packages-internal/core-docs/src/ApiPage/table/ClassesTable.tsx | Hides marked rule names in table rows. |
| packages-internal/core-docs/src/ApiPage/sections/ClassesSection.tsx | Conditionally hides rule names and the theme hint. |
| packages-internal/core-docs/src/ApiPage/list/ClassesList.tsx | Hides marked rule names in list entries. |
| packages-internal/core-docs/src/ApiPage/definitions/types.ts | Adds the optional rule-name eligibility field. |
| packages-internal/api-docs-builder/src/utils/parseSlotsAndClasses.ts | Checks theme keys using each class’s owner. |
| packages-internal/api-docs-builder/src/utils/parseSlotsAndClasses.test.ts | Tests theme-key detection and fallback behavior. |
| packages-internal/api-docs-builder/src/types/ApiBuilder.types.ts | Defines the marker for unsupported override keys. |
Review effort: Balanced
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Janpot
left a comment
There was a problem hiding this comment.
Fine by me, is the goal eventually to deprecate styleOverrides? Or are we just going to have a set of components that is not overridable?
| /** | ||
| * `false` when the theme `styleOverrides` do not accept the key. | ||
| */ | ||
| isStyleOverridesKey?: false; |
There was a problem hiding this comment.
Naming is confusing, shouldn't we rather name after the behavior? isThemeStyleOverridable or something?
Generated API pages show a rule name, and the hint to use it in the theme
styleOverrides, for each class that is not a globalMui-*state class. Some classes are notstyleOverrideskeys. The page then tells users to use a key that the theme types reject and the runtime ignores.Examples from #48823 (Menu2):
MuiMenu2Itemand 4 other item components document ahighlightedclass, butoverrides.tsmaps them toExclude<Menu2ItemClassKey, 'highlighted'>.MuiMenu2Triggerdocuments arootclass, butComponents['MuiMenu2Trigger']has onlydefaultProps.Changes
api-docs-builder:parseSlotsAndClassesreads theComponentNameToClassKeyandComponentsexports of the TS project. It setsisStyleOverridesKey: falseon a class when the theme of the class owner does not accept the key. The owner is theMui...prefix of the class name, so inherited classes (for exampleMuiDrawer-*on SwipeableDrawer) keep their rule name. The builder writes the field only when it isfalse.core-docs: the API page hides the rule name of a marked class. When classes are marked and no class has a rule name, the page also hides the rule name column and thestyleOverrideshint.generate-llms-txt: the llms.txt CSS table shows a marked class in the "Global class" column and does not show a rule name for it.Impact
pnpm docs:apiandpnpm proptypeschange no generated files.ComponentNameToClassKeyorComponents. X only augments@mui/material/styles, so the X output does not change.Generated with Claude Code