Getting started
Installation
Set up a React project with Tailwind CSS v4, then add the base styles and the cn() helper.
With the CLI
If your project already has Tailwind CSS v4, the shadcn CLI does the setup. Run init with the Kanso base style, then add components.
$ npx shadcn@latest init https://konsa.rohitxyz.me/r/kanso.json$ npx shadcn@latest add https://konsa.rohitxyz.me/r/button.jsonManual
Create a project
npx create-next-app@latest my-app --ts --tailwind --appInstall the shared dependencies
npm install radix-ui class-variance-authority clsx tailwind-merge lucide-reactAdd the cn() helper
lib/utils.ts
import { clsx, type ClassValue } from "clsx";
import { twMerge } from "tailwind-merge";
export function cn(...inputs: ClassValue[]) {
return twMerge(clsx(inputs));
}Add the tokens to your global CSS
app/globals.css
@import "tailwindcss";
@custom-variant dark (&:where(.dark, .dark *));
:root {
--radius: 0.5rem;
--background: oklch(1 0 0);
--foreground: oklch(0.17 0 0);
--card: oklch(1 0 0);
--card-foreground: oklch(0.17 0 0);
--popover: oklch(1 0 0);
--popover-foreground: oklch(0.17 0 0);
--primary: oklch(0.2 0 0);
--primary-foreground: oklch(0.985 0 0);
--secondary: oklch(0.965 0 0);
--secondary-foreground: oklch(0.2 0 0);
--muted: oklch(0.965 0 0);
--muted-foreground: oklch(0.52 0 0);
--accent: oklch(0.955 0 0);
--accent-foreground: oklch(0.2 0 0);
--destructive: oklch(0.58 0.22 27);
--destructive-foreground: oklch(0.985 0 0);
--success: oklch(0.6 0.14 150);
--border: oklch(0.915 0 0);
--input: oklch(0.9 0 0);
--ring: oklch(0.55 0 0);
}
.dark {
--background: oklch(0.155 0 0);
--foreground: oklch(0.96 0 0);
--card: oklch(0.18 0 0);
--card-foreground: oklch(0.96 0 0);
--popover: oklch(0.19 0 0);
--popover-foreground: oklch(0.96 0 0);
--primary: oklch(0.95 0 0);
--primary-foreground: oklch(0.18 0 0);
--secondary: oklch(0.24 0 0);
--secondary-foreground: oklch(0.96 0 0);
--muted: oklch(0.23 0 0);
--muted-foreground: oklch(0.68 0 0);
--accent: oklch(0.25 0 0);
--accent-foreground: oklch(0.96 0 0);
--destructive: oklch(0.65 0.2 25);
--destructive-foreground: oklch(0.985 0 0);
--success: oklch(0.7 0.14 150);
--border: oklch(1 0 0 / 9%);
--input: oklch(1 0 0 / 14%);
--ring: oklch(0.6 0 0);
}
@theme inline {
--color-background: var(--background);
--color-foreground: var(--foreground);
--color-card: var(--card);
--color-card-foreground: var(--card-foreground);
--color-popover: var(--popover);
--color-popover-foreground: var(--popover-foreground);
--color-primary: var(--primary);
--color-primary-foreground: var(--primary-foreground);
--color-secondary: var(--secondary);
--color-secondary-foreground: var(--secondary-foreground);
--color-muted: var(--muted);
--color-muted-foreground: var(--muted-foreground);
--color-accent: var(--accent);
--color-accent-foreground: var(--accent-foreground);
--color-destructive: var(--destructive);
--color-destructive-foreground: var(--destructive-foreground);
--color-success: var(--success);
--color-border: var(--border);
--color-input: var(--input);
--color-ring: var(--ring);
--radius-sm: calc(var(--radius) - 4px);
--radius-md: calc(var(--radius) - 2px);
--radius-lg: var(--radius);
--radius-xl: calc(var(--radius) + 4px);
--animate-in: k-in 150ms ease-out;
--animate-out: k-out 120ms ease-in;
--animate-slide-in-right: k-slide-right 220ms cubic-bezier(0.32, 0.72, 0, 1);
--animate-accordion-down: k-acc-down 180ms ease-out;
--animate-accordion-up: k-acc-up 180ms ease-out;
--animate-indeterminate: k-indeterminate 1.2s ease-in-out infinite;
}
@keyframes k-in {
from { opacity: 0; transform: scale(0.97) translateY(2px); }
}
@keyframes k-out {
to { opacity: 0; transform: scale(0.97); }
}
@keyframes k-blink {
50% { opacity: 0; }
}
@keyframes k-marquee {
to { transform: translateX(-100%); }
}
@keyframes k-fade {
from { opacity: 0; }
}
@keyframes k-slide-right {
from { transform: translateX(100%); }
}
@keyframes k-acc-down {
from { height: 0; }
to { height: var(--radix-accordion-content-height); }
}
@keyframes k-acc-up {
from { height: var(--radix-accordion-content-height); }
to { height: 0; }
}
@keyframes k-indeterminate {
0% { transform: translateX(-100%); }
100% { transform: translateX(250%); }
}
@layer base {
* {
border-color: var(--border);
outline-color: color-mix(in oklab, var(--ring) 50%, transparent);
}
html {
scroll-padding-top: 5rem;
}
body {
background: var(--background);
color: var(--foreground);
font-feature-settings: "ss01", "cv11";
}
::selection {
background: color-mix(in oklab, var(--foreground) 14%, transparent);
}
@media (prefers-reduced-motion: reduce) {
*, *::before, *::after {
animation-duration: 1ms !important;
transition-duration: 1ms !important;
}
}
}Check the path alias
Components import from @/lib/utils and @/components/ui/*. Make sure @/* points at your source folder in tsconfig.json.
Add your first component
Open any component page, copy the source to components/ui/, and import it.