CSS-in-JS with near-zero runtime, SSR, multi-variant support, and a best-in-class developer experience.
Stitches avoids unnecessary prop interpolations at runtime, making it more performant than other styling libraries.
Packed full of useful features like theming, smart tokens, css
prop, as
prop, utils, and a fully-typed API.
Stitches has a fully-typed API, to minimize the learning curve, and provide the best possible developer experience.
Stitches has a dedicated React lib, but @stitches/core
works with any framework including Vue, Svelte, and even vanilla HTML.
Lorem ipsum dolor, sit amet consectetur adipisicing elit. Repellendus repellat laudantium.
Variants are a first-class citizen of Stitches. With multiple variants, compound variants, and default variants, you can design composable component APIs which are typed automatically.
Define multiple component variants.
Apply styles only when multiple variants match.
Set a value as the default for each variant.
const Button = styled("button", {// base stylesvariants: {color: {gray: {backgroundColor: 'gainsboro',},blue: {backgroundColor: 'dodgerblue',},},size: {md: {height: '25px',},lg: {height: '35px',}}},});
Stitches has built-in solutions for tokens and theming, which use CSS variables under-the-hood. You can define multiple themes, then expose them to any part of your app.
Define tokens with our built-in solution.
Reference pre-existing tokens to define semantic aliases.
Override tokens to define multiple themes.
const { createTheme } = createStitches({theme: {fonts: {},space: {},sizes: {},fontSizes: {},fontWeights: {},lineHeights: {},letterSpacings: {},radii: {},zIndices: {},colors: {gray100: 'hsl(206 14% 96%)',gray200: 'hsl(206 12% 90%)',gray300: 'hsl(206 6% 56%)',gray400: 'hsl(206 6% 44%)',violet100: 'hsl(252 87% 96%)',violet200: 'hsl(252 83% 87%)',violet300: 'hsl(252 62% 54%)',violet400: 'hsl(250 55% 48%)',}}});
Lorem ipsum dolor, sit amet consectetur adipisicing elit. Repellendus repellat laudantium.
Stitches avoids unnecessary prop interpolations at runtime, making it more performant than other styling libraries.
Stitches supports cross-browser server-side rendering, even for responsive styles and variants.
With a fully-typed API, token-aware properties, and custom utils, Stitches offers a fun and intuitive DX.
Stitches only injects the styles which are actually used, so your users don't download unnecessary CSS.
A polymorphic as
prop is included in components returned from the styled
function.
Stitches provides a css
prop, which allows style overrides to be applied in the consumption layer.
Tokens automatically map to the most appropriate scale—with a simple syntax—for a smooth developer experience. You can customise the default mapping with our themeMap
object, or override the default on a case-by-case basis.
With a fully-typed API, token-aware properties, and custom utils, Stitches offers a fun and intuitive DX.
Override the default and map to any scale.
const Button = styled("button", {color: '$violet400',paddingLeft: '$4',paddingRight: '$4',height: '$6',fontSize: '$3',border: '1px solid $pink500',});
Invent your own custom CSS properties with our utils feature. Speed up your workflow by abbreviating CSS properties, grouping multiple CSS properties together, or simplifying a tricky syntax.
Abbreviate CSS properties.
Apply multiple CSS properties simultaneously.
Simplify a tricky CSS syntax.
export const { styled, css } = createStitches({utils: {pt: (value) => ({paddingTop: value,}),pr: (value) => ({paddingRight: value,}),pb: (value) => ({paddingBottom: value,}),pl: (value) => ({paddingLeft: value,}),},});
Sharing some love from the community ❤️
Get involved in our community. Everyone is welcome!