shadcn/ui
shadcn/ui is a collection of reusable components built with Radix UI / Base UI and Tailwind CSS. This guide covers how to use shadcn/ui components in your Rspress documentation site.
Make sure you have already set up Tailwind CSS in your project before proceeding.
Configure path aliases
Add paths to the compilerOptions in your tsconfig.json so that shadcn/ui components can be resolved correctly:
Create components.json and utility function
Since shadcn init cannot automatically detect the Rspress framework, you need to follow the manual installation approach to create the configuration files.
Create a components.json file in your project root to configure the shadcn/ui CLI:
tailwind.configis omitted because Tailwind CSS v4 no longer requires a config file.rscis set tofalsebecause Rspress does not use React Server Components.
Then install the dependencies and create the utility function:
Add components
Use the shadcn CLI to add the components you need. For example, to add a Button:
Usage in MDX
Import and use components in your MDX files:
Since shadcn/ui is not a traditional npm package but a collection of copy-paste components, you have full control over the component code and can customize them as needed.