- Checkout this repository
- Have corepack enabled:
corepack enable yarn installyarn watch- Do your changes (see below)
- Use
yarn generateOverridesto add any new classes also to the Overrides module. - Commit and create a Pull Request
- Take any component from MUI and look for its
d.tsfile, e.g. Accordion.d.ts - Copy the content of the props type over, including the documentation comments.
- Copy also the classes type over, e.g. accordionClasses.ts. This one always must be
type classesas it gets picked up by thegenerateOverridesscript. - Replace all
;with,and adapt the types accordingly. - Cross-check with the corresponding MUI page, e.g. https://mui.com/material-ui/api/accordion/, if you ended up with all the listed props (execept for deprecated ones)
- Have a look at
Accordion.resfor inspiration.
- Every main props type needs to inherit from
CommonProps.t, except if MUI documentation explicitly says that only the listed props are the valid ones. - If some component inherits from a MUI parent, the props to inherit from need to be called publicProps, e.g.
Paper.publicProps. This is necessary, because prop names cannot be overwritten with different types. For instance theclassestype is different betweenAccordionandPaper(of which the former inherits most props).
- For uppercase names, always use @as and write the first letter lowercase
- if there is a conflict, add a
_behind the name - Examples:
InputPropsconflicts withinputPropsso it becomesinputProps_MuiSliderbecomesmuiSlider
- if there is a conflict, add a
- For props that are ReScript keywords, add a
_behind the name- Examples:
typebecomestype_openbecomesopen_
- Examples:
The scripts/ folder contains two Node helpers used when bumping the bindings to a new MUI version. Both read the actual TypeScript definitions from the installed @mui/material package, so first run yarn install with the target MUI version, then run them from the repository root.
Regenerates the type classes = {...} block of material components from the real @mui/material/<Component>/<component>Classes.d.ts files (doc comments included). Useful whenever MUI adds, removes or renames CSS classes.
# dry-run: print the generated block for every component (nothing is written)
node scripts/gen-classes.mjs
# dry-run for specific components only
node scripts/gen-classes.mjs Button Chip
# write the changes into the .res files
node scripts/gen-classes.mjs --apply Button Chip
# ...or regenerate every component at once
node scripts/gen-classes.mjs --applyAfter running with --apply, rebuild (yarn build) and regenerate the theme overrides (yarn generateOverrides) so the *ClassKey types stay in sync.
Reports props that exist in the current MUI .d.ts but are missing from a binding. It reads each material component's own props (resolving ReScript record spreads such as ...Paper.publicProps transitively) and diffs them against the component's own-props interface in the .d.ts.
node scripts/prop-diff2.mjsEvery line lists a component and the props it is missing; no output means everything is in sync. It cannot inspect components whose props are a plain type alias without an OwnProps/Props interface (e.g. Box, Select) — those need a manual check.
- Keep the base version (e.g.
6.1.0) in each packagepackage.json. Do not add prerelease suffixes there. - Merges to
masterpublish prereleases for changed packages as6.1.0-dev.Nwith npm dist-tagnext. - Stable releases are triggered by pushing a git tag like
v6.1.0and publish with npm dist-taglatest.