Skip to content
Language22
Menu

Docs / Frameworks

React Router

Add UI Loft items to a React Router app in framework mode. New apps come with Tailwind and an import alias, so it's three commands.

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

Set up

  1. Create the app

    Skip this if you already have one. --yes takes the defaults.

    Terminal
    npx create-react-router@latest my-app --yes
    cd my-app
  2. Set up shadcn

    It makes a components.json that says where new files go. -d takes the defaults.

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

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

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

    Import it in a route.

    app/routes/home.tsx
    import { GlowButton } from "~/components/glow-button"
    
    export default function Home() {
      return <GlowButton>Get started</GlowButton>
    }

Good to know

  • Imports start with ~/, not @/. shadcn changes the item's own imports to match.
  • An older or hand-made app needs Tailwind 4 and the ~/* path alias before Set up shadcn.
  • These steps were checked with React Router 8.

Other frameworks