Join our Discord Community
Installation

Install shadcn/ui Router

How to install shadcn/ui with React Router v7. Setup guide for the new framework features and built-in bundling.

How to install shadcn/ui with React Router

React Router v7 isn't just a router anymore—it's a full framework with bundling, server rendering, and more. Perfect with shadcn/ui for modern React apps.

React Router v7 setup

Create React Router app

npx create-react-router@latest my-app
cd my-app

Choose TypeScript when prompted for better component IntelliSense.


Initialize shadcn/ui

npx shadcn@latest init

The CLI detects React Router and configures everything correctly.


Add components

npx shadcn@latest add button card navigation-menu

Components are added to app/components/ui/.


Use in your routes

// app/routes/home.tsx
import { Button } from "~/components/ui/button"
import { Card, CardContent, CardHeader, CardTitle } from "~/components/ui/card"
import type { Route } from "./+types/home"

export function meta({}: Route.MetaArgs) {
  return [
    { title: "React Router + shadcn/ui" },
    { name: "description", content: "Modern React with beautiful components" },
  ]
}

export default function Home() {
  return (
    <div className="container mx-auto p-8">
      <Card>
        <CardHeader>
          <CardTitle>Welcome to React Router v7</CardTitle>
        </CardHeader>
        <CardContent>
          <p>Full-stack React with shadcn/ui components</p>
          <Button className="mt-4">Get Started</Button>
        </CardContent>
      </Card>
    </div>
  )
}

File structure

react-router.config.ts
components.json

Deployment

React Router v7 apps deploy anywhere:

PlatformSetupBest For
VercelAutomatic detection and setupZero config deployment
NetlifyBuilt-in adapter supportGreat build features
CloudflareWorkers and PagesEdge performance
AWSLambda or containerizedEnterprise scale
Node.jsAny Node hostTraditional hosting

Migration from v6

If upgrading from React Router v6:

  1. Update to v7: npm install react-router@latest
  2. Move routes to app/routes/
  3. Update imports from react-router-dom to react-router
  4. Add shadcn/ui with the CLI

Next steps

With React Router v7 + shadcn/ui configured:

  1. Browse official components for forms, tables, and UI elements
  2. Add charts for data visualization
  3. Explore community components for extended functionality
  4. Add useful hooks to enhance your components
  5. Use pre-built blocks to quickly build common layouts

React Router v7's framework features combined with shadcn/ui's components give you everything needed for production React apps.

Questions you're probably thinking