Skip to content

[docs-infra] Hide rule names that are not styleOverrides keys - #49778

Draft
LukasTy wants to merge 3 commits into
mui:masterfrom
LukasTy:claude/competent-hugle-ba13a4
Draft

LukasTy wants to merge 3 commits into
mui:masterfrom
LukasTy:claude/competent-hugle-ba13a4

Conversation

@LukasTy

@LukasTy LukasTy commented Nov 13, 2026 •

Copy link
Copy Markdown
Member

Generated API pages show a rule name, and the hint to use it in the theme styleOverrides, for each class that is not a global Mui-* state class. Some classes are not styleOverrides keys. The page then tells users to use a key that the theme types reject and the runtime ignores.

Examples from #48823 (Menu2):

  • MuiMenu2Item and 4 other item components document a highlighted class, but overrides.ts maps them to Exclude<Menu2ItemClassKey, 'highlighted'>.
  • MuiMenu2Trigger documents a root class, but Components['MuiMenu2Trigger'] has only defaultProps.

Changes

  • api-docs-builder: parseSlotsAndClasses reads the ComponentNameToClassKey and Components exports of the TS project. It sets isStyleOverridesKey: false on a class when the theme of the class owner does not accept the key. The owner is the Mui... prefix of the class name, so inherited classes (for example MuiDrawer-* on SwipeableDrawer) keep their rule name. The builder writes the field only when it is false.
  • 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 the styleOverrides hint.
  • 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

  • Master: pnpm docs:api and pnpm proptypes change no generated files.
  • Menu2 branch: only the 6 Menu2 item and trigger API JSON files change.
  • MUI X: no package entry point exports ComponentNameToClassKey or Components. X only augments @mui/material/styles, so the X output does not change.

Generated with Claude Code

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]>
@LukasTy LukasTy added scope: docs-infra Involves the docs-infra product (https://www.notion.so/mui-org/b9f676062eb94747b6768209f7751305). type: enhancement It’s an improvement, but we can’t make up our mind whether it's a bug fix or a new feature. labels Nov 13, 2026
@code-infra-dashboard

code-infra-dashboard Bot commented Nov 13, 2026 •

Copy link
Copy Markdown

Deploy preview

https://deploy-preview-49778--material-ui.netlify.app/
QR code for https://deploy-preview-49778--material-ui.netlify.app/

Bundle size

Bundle Parsed size Gzip size
@mui/material 0B(0.00%) 0B(0.00%)
@mui/lab 0B(0.00%) 0B(0.00%)
@mui/private-theming 0B(0.00%) 0B(0.00%)
@mui/system 0B(0.00%) 0B(0.00%)
@mui/utils 0B(0.00%) 0B(0.00%)

Details of bundle changes

Performance

No 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.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 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

@LukasTy
LukasTy marked this pull request as ready for review November 13, 2026 11:13
@LukasTy
LukasTy marked this pull request as draft November 13, 2026 15:27

@Janpot Janpot left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Naming is confusing, shouldn't we rather name after the behavior? isThemeStyleOverridable or something?

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

scope: docs-infra Involves the docs-infra product (https://www.notion.so/mui-org/b9f676062eb94747b6768209f7751305). type: enhancement It’s an improvement, but we can’t make up our mind whether it's a bug fix or a new feature.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants