Native Solid 2 fork. Original documentation and designs © WorkOS; historical posts retain their original context.

Breakpoints

Built-in breakpoints allow you to easily build adaptive layouts.

Available sizes

Each breakpoint matches a fixed screen width. Values are min-width based and apply when the screen width is equal or greater.

SizeWidth
initial
Phones (portrait)
0px
xs
Phones (landscape)
520px
sm
Tablets (portrait)
768px
md
Tablets (landscape)
1024px
lg
Laptops
1280px
xl
Desktops
1640px

Usage

Most component size and layout props will accept an additional Responsive object shape for modifying the given prop across breakpoints.

Each size maps to a corresponding key, the value of each will be applied when the screen size is greater than or equal to the named breakpoint.

<Heading size={{ initial: "3", md: "5", xl: "7" }} />

PostCSS plugins

The package's CSS files are compiled, so importing them needs no PostCSS setup. The postcss-breakpoints and postcss-whitespace plugins are only for teams that build their own responsive rt-r- classes the way Themes does. postcss is an optional peer dependency, so install it when you use a plugin:

pnpm add -D postcss@^8.5.9
// postcss.config.mjs
import breakpoints from "@wsagency/radix2solid-themes/postcss-breakpoints";
export default { plugins: [breakpoints()] };

CommonJS configs can require("@wsagency/radix2solid-themes/postcss-breakpoints"). The plugin expands each @breakpoints block into one @media rule per breakpoint and prefixes the rt-r- classes inside it with the breakpoint name, for example .xs\:rt-r-size-2.