百科.dev
全部条目AI 编程趋势榜开源项目技术资讯提交条目
登录
< 返回工具列表
T

tss-react

> 前端框架
开源

✨ 基于 Emotion 的动态 CSS-in-TS 解决方案

722 stars0 点赞0 次浏览
访问官网GitHub

工具介绍

✨ 基于 Emotion 的动态 CSS-in-TS 解决方案

✨ Dynamic CSS-in-TS solution, based on Emotion ✨

Home

Documentation

Playground

You can think of tss-react as @emotion/jss.
It's, in essence, a type-safe equivalent of the JSS API but powered by Emotion, just like @emotion/styled is the styled-components API but powered by Emotion.

  • Seamless integration with MUI.
  • Works in Next.js App and Page Router.
  • ‍♂️ No custom styling syntax to learn, no shorthand, just plain CSS.
  • Dynamic Style Generation: TSS enables to generate styles based on the props and internal states of components.
This unfortunately prevents us from supporting [Server Component (RSC)](https://nextjs.org/docs/getting-started/react-essentials#server-components) in Next.js.  
We remain hopeful for future support of RSC, contingent on [the provision of a suitable solution by Vercel and React](https://github.com/vercel/next.js/blob/dc6c22c99117bb48beedc4eed402a57b21f03963/docs/02-app/01-building-your-application/04-styling/03-css-in-js.mdx#L10-L12).  
If you need RSC support today, you can consider _zero runtime_ solutions like Panda-CSS or Vanilla Extract,
but the expression of complex styles is significantly harder in this paradigm.
  • Your JSX remains readable. Unlike other styling solution that tend to clutter the JSX, TSS enables isolating the styles from the component structure.
That been said, sometime it's just easier to inline the styles directly within your components, [TSS enables this as well](https://stackblitz.com/edit/vercel-next-js-bmc6dm?file=ui/TssLogo_intertwined.tsx).
  • ️ Eliminate CSS priority conflicts! With TSS you can determine the precedence of multiple classes applied to a component and arbitrarily increase specificity of some rules.
  • Offers a type-safe equivalent of the JSS $ syntax.
  • ⚙️ Freely customize the underlying @emotion cache.
  • ✨ Improved withStyles API featured, to help you migrate away from @material-ui v4.
  • ️ Build on top of @emotion/react, it has very little impact on the bundle size alongside mui (~5kB minziped).
  • ⬆️ 'tss-react' can be used as an advantageous replacement for @material-ui v4 makeStyles and 'react-jss'.
  • Maintained for the foreseeable future, issues are dealt with within good delays.
  • Library authors: tss-react won’t be yet another entry in your peerDependencies.

demo.webm

While this module is written in TypeScript, using TypeScript in your application is optional (but recommended as it comes with outstanding benefits to both you and your codebase).

Get started 

The more ⭐️ the project gets, the more time I spend improving and maintaining it. Thank you for your support

Needless to mention, this library is heavily inspired by JSS, the OG CSS-in-JS solution.

Development

Running the demo apps:

git clone https://github.com/garronej/tss-react
cd tss-react
yarn
yarn build
npx tsc -w & npx tsc --module es2015 --outDir dist/esm -w
# Open another Terminal
yarn start_spa  # For testing in in a Create React App setup
yarn start_ssr # For testing in a Next.js setup
yarn start_appdir #  Next.js 13 setup in App directory mode

Security contact information

To report a security vulnerability, please use the Tidelift security contact. Tidelift will coordinate the fix and disclosure.

Issues· 0 开放

查看全部 Issues在 GitHub 打开

暂无开放 Issues,或尚未同步最近议题。

> 标签

TypeScriptcsscss-in-jsjssmaterial-ui

暂无评论,来聊聊你的看法吧

> 工具信息

发布日期2026年8月1日
最后更新2026年9月17日
分类前端框架
定价开源

> 相关工具

R
React
用于构建用户界面的 JavaScript 库
V
Vue.js
渐进式 JavaScript 框架
N
Next.js
基于 React 的全栈 Web 框架