Before making large PRs, you may want to discuss your proposals in either the Discord Contributing Channel, the GitHub Discussions page, or the GitHub Issues page.
This project uses PNPM and a TurboRepo with 2 projects.
- The library itself in
/packages/mantine-react-table
which also contains a storybook site for local development - The docs site in
/apps/mantine-react-table-docs
Create your own fork, clone, and then make a feature/bugfix branch off of main
. Branch name does not really matter.
pnpm i
pnpm storybook
The Storybook site will open on port 6007
by default.
pnpm docs:dev
The Docs site will open on port 3001
by default.
Note: If you are contributing a new locale and are trying to test it in the docs site, you will need to run
pnpm lib:build-locales
and thenpnpm docs:dev
before it can be imported.
If you are just using Storybook for local development you don't need to do this, but if you want to see library code changes while running the docs you'll need to have the library run in watch mode:
In a 2nd terminal, run:
pnpm lib:dev
Alternatively, you can just run pnpm dev
in just 1 terminal and both the library and docs will run in dev mode for development
pnpm lib:build
Note: After building the library, if you are running the docs site locally, it will use the compiled output of the dist folder. This can be annoying if you are trying to test changes to the library in the docs site itself. Just delete the
/dist
folder to test lib changes in the docs site.
- All styles should be written in
.module.css
files with a file name that matches thecomponent.tsx
file name. - All dynamic styles should be handed with CSS variables (
__vars
prop) - CSS variables should be named
--mrt-<component/element-name>-<property-name>
(e.g.--mrt-tbody-display
) in order to avoid name collisions with elements down the tree. - Class names in
.module.css
files don't really matter since they get compiled away, but just use all lowercase and hyphenated (e.g.table-cell
). Just use.root
for the root element, and use other names that make sense for sub-elements. - All major elements in internal MRT components should have an
mrt-<component/element-name>
class name (e.g.mrt-table-body-cell
). - Always use the
clsx
utility to assign class names to elements. Always allow formantine*Props.className
to be passed in and merged with the internal class names. For example
className={clsx('mrt-table-body', classes.root, tableBodyProps.className)}`
- When assigning
__vars
orstyles
, don't forget to spread...mantine*Props.__vars
in order to allow for external variables to be passed in and merged with internal variables. For example
__vars={{
'--mrt-table-body-cell-padding': '10px',
...tableBodyProps?.__vars,
}}