Manual Installation
Add dependencies to your project manually.
Add Tailwind CSS
Components are styled using Tailwind CSS. You need to install Tailwind CSS in your project.
Follow the Tailwind CSS installation instructions to get started.
Add dependencies
Add the following dependencies to your project:
npm install tailwindcss-animate class-variance-authority clsx tailwind-merge
Add icon library
npm install lucide-react
Configure path aliases
I use the @
alias. This is how I configure it in tsconfig.json:
{
"compilerOptions": {
"baseUrl": ".",
"paths": {
"@/*": ["./*"]
}
}
}
The @
alias is a preference. You can use other aliases if you want.
If you use a different alias such as ~, you'll need to update import statements when adding components.
Configure tailwind.config.js
Here's what my tailwind.config.js
file looks like:
const { fontFamily } = require("tailwindcss/defaultTheme")
/** @type {import('tailwindcss').Config} */
module.exports = {
content: ["app/**/*.{ts,tsx}", "components/**/*.{ts,tsx}"],
theme: {
container: {
center: true,
padding: "1rem",
screens: {
"2xl": "1400px",
},
},
extend: {
colors: {
background: "hsl(var(--background))",
foreground: "hsl(var(--foreground))",
primary: "hsl(var(--primary))",
destructive: "hsl(var(--destructive))",
popover: "hsl(var(--popover))",
},
fontFamily: {
sans: ["var(--font-geist-sans)", ...fontFamily.sans],
},
keyframes: {
"accordion-down": {
from: { height: "0" },
to: { height: "var(--radix-accordion-content-height)" },
},
"accordion-up": {
from: { height: "var(--radix-accordion-content-height)" },
to: { height: "0" },
},
"caret-blink": {
"0%,70%,100%": { opacity: "1" },
"20%,50%": { opacity: "0" },
},
},
animation: {
"accordion-down": "accordion-down 0.2s ease-out",
"accordion-up": "accordion-up 0.2s ease-out",
"caret-blink": "caret-blink 1.25s ease-out infinite",
},
},
},
plugins: [require("tailwindcss-animate")],
}
Configure styles
Add the following to your styles/globals.css file. You can learn more about using CSS variables for theming in the theming section.
@tailwind base;
@tailwind components;
@tailwind utilities;
@layer base {
:root {
--primary: 254 12% 100%;
--popover: 260 4% 15%;
--background: 254 12% 6%;
--foreground: 254 12% 100%;
--destructive: 10 92% 66%;
}
}
@layer base {
* {
@apply border-primary;
}
body {
@apply bg-background text-primary;
}
}
::-webkit-scrollbar {
height: 8px;
width: 8px;
}
::-webkit-scrollbar-track {
background-color: transparent;
}
::-webkit-scrollbar-thumb {
border-radius: 10px;
@apply bg-primary;
}
::selection {
@apply bg-primary;
@apply text-background;
}
Add a cn helper
I use a cn
helper to make it easier to conditionally add Tailwind CSS classes. Here's how I define it in lib/utils.ts
:
import { clsx, type ClassValue } from "clsx"
import { twMerge } from "tailwind-merge"
export function cn(...inputs: ClassValue[]) {
return twMerge(clsx(inputs))
}
That's it
You can now start adding components to your project.