This project demonstrates how to integrate TailwindCSS and Shadcn/UI with Docusaurus V3, creating a modern documentation website with beautiful, accessible UI components. Perfect for technical documentation, blogs, and project websites.
@easyops-cn/docusaurus-search-local
for search functionalityThe website also features a new blog UI was built using TailwindCSS & Shadcn/UI components and provides a modern, clean interface for displaying blog posts. The blog posts are managed by a custom blog plugin, defined in src/plugins/blog-plugin.js
and homepage config in components/Homepage/index.js
.
You can get started by creating your own Docusaurus website and deploy to Vercel by clicking the link:
Vercel will copy the Docusaurus TailwindCSS Shadcn/ui and deploy the website for you. Once completed, every commit in the repo will be deployed automatically.
git clone https://github.com/namnguyenthanhwork/docusaurus-tailwind-shadcn-template.git
cd docusaurus-tailwind-shadcn-template
npm install
npm start
npm run build
docusaurus-tailwind-shadcn-template/
āāā blog/
āāā docs/
āāā src/
ā āāā components/
ā ā āāā ui/ # Shadcn/UI components
ā āāā css/
ā ā āāā custom.css # TailwindCSS and custom styles
ā āāā lib/
ā ā āāā utils.ts # Utility functions
ā āāā pages/ # React pages
āāā static/
āāā tailwind.config.js # TailwindCSS configuration
āāā postcss.config.js # PostCSS configuration
āāā docusaurus.config.js # Docusaurus configuration
The project includes a custom TailwindCSS configuration optimized for Docusaurus:
// tailwind.config.js
module.exports = {
content: [
"./src/**/*.{js,jsx,ts,tsx}",
"./docs/**/*.{js,jsx,ts,tsx}",
"./blog/**/*.{js,jsx,ts,tsx}",
],
darkMode: ["class", '[data-theme="dark"]'], // Support Docusaurus dark mode
// ... rest of the configuration
}
All Shadcn/UI components are located in src/components/ui/
. To use a component:
import { Button } from '../components/ui/button';
function MyComponent() {
return (
<Button variant="outline">
Click me
</Button>
);
}
Note: You can't install Shadcn/UI via CLI, so you need to copy the components (manual) and change the import path.
The local search is configured in docusaurus.config.js
:
themes: [
[
require.resolve('@easyops-cn/docusaurus-search-local'),
{
indexPages: true,
docsRouteBasePath: '/docs',
hashed: true,
language: ['en'],
highlightSearchTermsOnTargetPage: false,
searchResultContextMaxLength: 50,
searchResultLimits: 8,
searchBarShortcut: true,
searchBarShortcutHint: true
}
]
],
tailwind.config.js
src/css/custom.css
src/components/ui/
src/components/ui/
or src/components/
Example:
// src/components/ui/custom-button.tsx
import { Button } from './button';
export function CustomButton({ children }) {
return (
<Button className="custom-styles">
{children}
</Button>
);
}
We welcome contributions! Please follow these steps:
git checkout -b feature/amazing-feature
git commit -m 'Add amazing feature'
git push origin feature/amazing-feature
This project is licensed under the MIT License - see the LICENSE file for details.
Built with ā„ by [namnguyenthanhwork]