MDX Deep Dive
Using Shadcn UI
1
Install the npm packages. Run the following command at the root of your project.
Shell
2
Create a components directory and create lib/utils.ts
src/components/lib/utils.ts
3
Copy the component you want to use.
Follow the steps in the “Manual” tab on the shadcn/ui components page.
For example, for Button:
- Install additional packages
Shell
- Copy the component.
Be sure to change the import paths of lib/util
and other components to relative paths.
The current version (v0.1.x) does not support custom color schemes (such as bg-primary, text-primary-foreground) set up with shadcn/ui.
Therefore, you need to manually change the parts of the component’s style that relate to the custom color scheme. For example: bg-primary -> bg-zinc-900
This issue will be resolved in an upcoming update!
src/components/button.tsx
4
Use the component in an mdx file.
index.mdx