Skip to content
Language22
Menu

Docs / Frameworks

Next.js

Add UI Loft items to a Next.js app with the shadcn CLI. You set up once, then every item is one command.

Version
React
Needs
Tailwind 4 + shadcn
Setup time
About 2 minutes

Set up

  1. Create the app

    Skip this if you already have one. shadcn's Next.js template comes with TypeScript, Tailwind, the App Router and the Geist font set up.

    Terminal
    npx shadcn@latest init -t next -n my-app -d
    cd my-app
  2. Already have an app? Set up shadcn

    It makes a components.json that says where new files go. If your app/layout.tsx came from create-next-app, change --font-geist-sans to --font-sans there, or text shows in a serif font.

    Terminal
    npx shadcn@latest init -d
  3. Add an item

    Copy the command from any item page. The file lands in components/.

    Terminal
    npx shadcn@latest add https://uiloft.dev/r/glow-button.json
  4. Use it

    Import it in any page. It works in a Server Component page as is.

    app/page.tsx
    import { GlowButton } from "@/components/glow-button"
    
    export default function Page() {
      return <GlowButton>Get started</GlowButton>
    }

Good to know

  • Items that move or react to you already start with "use client". You don't add it yourself.
  • With --src-dir, files land in src/components/ and the import stays @/components/glow-button.
  • To update an item, run its command again. shadcn asks before it overwrites a file.

Other frameworks