UI - Shadcn

UI - Shadcn

  • Shadcn is not a npm package as of now.
  • It's a collection of re-usable components that you can copy and paste into your apps.
  • The creator wants us to have ownership of the code, so only need to copy the component we need.
  • Uses shadcn - Re-usable components built using Radix UI and Tailwind CSS
  • Follow the manual installation guide here to add to your project

CLI to Add Components

To add a shadcn component, simply run:

npx shadcn-ui add <component_name>
npx shadcn-ui add skeleton

This will auto add the component_name.tsx file under components\ui directory. Then just import and use the component:

import { Skeleton } from '@/components/ui/skeleton';
<Skeleton className="w-[100px] h-[20px] rounded-full" />;