LogoLogo
HomeGitHubPlayground
v4
v4
  • ๐Ÿ”งSetup
  • ๐Ÿ”API References
    • tss - the Modern API
    • keyframes
    • <GlobalStyles />
    • makeStyles -> useStyles
    • withStyles
  • โšกSSR
    • Next.js
    • Gatsby
    • Other backends
  • ๐ŸŽฏIncrease specificity
  • ๐Ÿฆฑclasses overrides
  • ๐ŸงนDetecting unused classes
  • ๐Ÿ’ฝEmotion Cache
  • ๐Ÿ’ซNested selectors (ex $ syntax)
  • ๐ŸญMUI Global styleOverrides
  • ๐Ÿ“ฆPublish a module that uses TSS
  • ๐ŸฉณMUI sx syntax
  • ๐Ÿ“ฒReact Native
  • ๐Ÿ†˜Fix broken styles after upgrading to MUI v5 with TSS
  • โฌ†๏ธMigration v3 -> v4
Powered by GitBook
On this page

Was this helpful?

Edit on GitHub

Publish a module that uses TSS

How to express you dependencies requirements

PreviousMUI Global styleOverridesNextMUI sx syntax

Last updated 8 months ago

Was this helpful?

package.json

"name": "YOUR_MODULE",
"dependencies": {
    "tss-react": "^4.0.0"
},
"peerDependencies": {
    "react": "^16.8.0 || ^17.0.2 || 18.0.0" ,
    "@mui/material": "^5.9.3 || ^6.0.0",
    "@emotion/react": "^11.4.1",
},
"devDependencies": {
    "@mui/material": "^5.0.1",
    "@emotion/react": "^11.4.1",
    "@emotion/styled": "^11.8.1"
}

Your users install your module like that:

yarn add YOUR_MODULE @mui/material @emotion/react @emotion/styled

The version of @mui/material must be newer or equal to 5.9.3

Regarding SSR setup you can forward your user to the dedicated .

package.json

"name": "YOUR_MODULE",
"dependencies": {
    "tss-react": "^4.0.0"
},
"peerDependencies": {
    "react": "^16.8.0 || ^17.0.2 || ^18.0.0",
    "@emotion/react": "^11.4.1",
},
"devDependencies": {
    "@emotion/react": "^11.4.1"
}

Your users install your module like that:

yarn add YOUR_MODULE @emotion/react

In any case, it is of paramount importance that your library supports CSJ and ESM distribution. Please refer to the following discussion for precise instructions and a comprehensive explanation of why this is crucial.

You should avoid using <TssCacheProvider /> or you should make tss-react as peerDependency of your module which you probably want to avoid.

Regarding SSR setup you can forward your user to .

Wherever you make use of you must to make sure your components will works in every SSR setup.

๐Ÿ“ฆ
MUI documentation
the dedicated documentation
nested selectors
provide a uniqId
MUI integration not working in production build ยท Issue #136 ยท garronej/tss-reactGitHub
Logo