<Flex />
, <Grid />
), this plugin is for you! With this plugin you can still develop using Tailwind classes (e.g., className="flex items-center gap-2"
).pnpm install radix-ui-themes-with-tailwind -D
# or
npm install radix-ui-themes-with-tailwind -D
# or
yarn install radix-ui-themes-with-tailwind -D
Then, add the plugin to your Tailwind config file.import type { Config } from "tailwindcss";
import { radixThemePlugin } from "radix-ui-themes-with-tailwind";
const config: Config = {
content: [
// ...
],
theme: {},
plugins: [
radixThemePlugin({
useTailwindColorNames: true,
useTailwindRadiusNames: true,
mapMissingTailwindColors: true,
}),
],
};
export default config;
<Flex gap="3">
<Box width="9" height="9">
<DecorativeBox />
</Box>
<Box width="9" height="9">
<DecorativeBox />
</Box>
<Box width="9" height="9">
<DecorativeBox />
</Box>
<Box width="9" height="9">
<DecorativeBox />
</Box>
<Box width="9" height="9">
<DecorativeBox />
</Box>
</Flex>
<div className="flex gap-3">
<div className="w-16 h-16">
<DecorativeBox />
</div>
<div className="w-16 h-16">
<DecorativeBox />
</div>
<div className="w-16 h-16">
<DecorativeBox />
</div>
<div className="w-16 h-16">
<DecorativeBox />
</div>
<div className="w-16 h-16">
<DecorativeBox />
</div>
</div>
Why 16 instead of 9? Because when mapping the spacing of radix to tailwind, I found that radix's spacing scale is very limited, and tailwind's spacing scale is much better. So I ported tailwind spacing scale with radix scaling factor. You can see the mapping in the source code
<Text as="p">
The <Em>most</Em> important thing to remember is,{" "}
<Strong>stay positive</Strong>.
</Text>
<Text size="4" as="p">
The <Em>most</Em> important thing to remember is,{" "}
<Strong>stay positive</Strong>.
</Text>
<Heading size="4">Typographic principles</Heading>
<Heading size="5">Typographic principles</Heading>
<Heading size="6">Typographic principles</Heading>
<Heading size="7">Typographic principles</Heading>
<Heading size="8">Typographic principles</Heading>
<Heading size="9">Typographic principles</Heading>
The most important thing to remember is, stay positive.
The most important thing to remember is, stay positive.
<p>
The <em>most</em> important thing to remember is,{" "}
<strong>stay positive</strong>.
</p>
<p className="text-lg">
The <em>most</em> important thing to remember is,{" "}
<strong>stay positive</strong>.
</p>
<h6>Typographic principles</h6>
<h5>Typographic principles</h5>
<h4>Typographic principles</h4>
<h3>Typographic principles</h3>
<h2>Typographic principles</h2>
<h1>Typographic principles</h1>
The most important thing to remember is, stay positive.
The most important thing to remember is, stay positive.