Next.js

Install and configure headcn/ui for Next.js.

Initialize

Run the init command to initialize on an existing project:

npx headcn@latest init

Add Components

You can now start adding components to your project.

npx headcn@latest add button

The command above will add the Button component to your project. You can then import it like this:

import { Button } from "@/components/ui/button"
 
export default function Home() {
  return (
    <div>
      <Button>Click me</Button>
    </div>
  )
}