From 8028a0d75dc420034ea073ad02fd85b94a68a640 Mon Sep 17 00:00:00 2001 From: shadcn Date: Tue, 17 Feb 2026 15:21:13 +0400 Subject: [PATCH] feat: add react-router template --- .../app/(create)/components/project-form.tsx | 8 +- apps/v4/app/(create)/lib/search-params.ts | 1 + apps/v4/registry/config.ts | 2 +- packages/shadcn/src/commands/init.ts | 2 +- packages/shadcn/src/templates/index.ts | 2 + packages/shadcn/src/templates/react-router.ts | 109 ++++++++++++++++++ templates/react-router-app/.dockerignore | 4 + templates/react-router-app/.gitignore | 7 ++ templates/react-router-app/.prettierrc | 11 ++ templates/react-router-app/Dockerfile | 22 ++++ templates/react-router-app/README.md | 21 ++++ templates/react-router-app/app/app.css | 1 + templates/react-router-app/app/root.tsx | 62 ++++++++++ templates/react-router-app/app/routes.ts | 3 + .../react-router-app/app/routes/home.tsx | 7 ++ templates/react-router-app/package.json | 33 ++++++ templates/react-router-app/public/favicon.ico | Bin 0 -> 15086 bytes .../react-router-app/react-router.config.ts | 7 ++ templates/react-router-app/tsconfig.json | 27 +++++ templates/react-router-app/vite.config.ts | 8 ++ 20 files changed, 334 insertions(+), 3 deletions(-) create mode 100644 packages/shadcn/src/templates/react-router.ts create mode 100644 templates/react-router-app/.dockerignore create mode 100644 templates/react-router-app/.gitignore create mode 100644 templates/react-router-app/.prettierrc create mode 100644 templates/react-router-app/Dockerfile create mode 100644 templates/react-router-app/README.md create mode 100644 templates/react-router-app/app/app.css create mode 100644 templates/react-router-app/app/root.tsx create mode 100644 templates/react-router-app/app/routes.ts create mode 100644 templates/react-router-app/app/routes/home.tsx create mode 100644 templates/react-router-app/package.json create mode 100644 templates/react-router-app/public/favicon.ico create mode 100644 templates/react-router-app/react-router.config.ts create mode 100644 templates/react-router-app/tsconfig.json create mode 100644 templates/react-router-app/vite.config.ts diff --git a/apps/v4/app/(create)/components/project-form.tsx b/apps/v4/app/(create)/components/project-form.tsx index 3ca5c1ce94..f02ef6e9bd 100644 --- a/apps/v4/app/(create)/components/project-form.tsx +++ b/apps/v4/app/(create)/components/project-form.tsx @@ -57,6 +57,11 @@ const TEMPLATES = [ title: "TanStack Start", logo: 'TanStack', }, + { + value: "react-router", + title: "React Router", + logo: '', + }, { value: "vite", title: "Vite", @@ -170,10 +175,11 @@ export function ProjectForm() { | "next" | "next-monorepo" | "start" + | "react-router" | "vite", }) }} - className="grid grid-cols-2 gap-2" + className="grid grid-cols-3 gap-2" > {TEMPLATES.map((template) => ( diff --git a/apps/v4/app/(create)/lib/search-params.ts b/apps/v4/app/(create)/lib/search-params.ts index ab00904568..ad0d7ba204 100644 --- a/apps/v4/app/(create)/lib/search-params.ts +++ b/apps/v4/app/(create)/lib/search-params.ts @@ -65,6 +65,7 @@ const designSystemSearchParams = { "next", "next-monorepo", "start", + "react-router", "vite", ] as const).withDefault("next"), rtl: parseAsBoolean.withDefault(false), diff --git a/apps/v4/registry/config.ts b/apps/v4/registry/config.ts index bfe1e20b6e..95c2e1cc42 100644 --- a/apps/v4/registry/config.ts +++ b/apps/v4/registry/config.ts @@ -95,7 +95,7 @@ export const designSystemConfigSchema = z .enum(RADII.map((r) => r.name) as [RadiusValue, ...RadiusValue[]]) .default("default"), template: z - .enum(["next", "next-monorepo", "start", "vite"]) + .enum(["next", "next-monorepo", "start", "react-router", "vite"]) .default("next") .optional(), }) diff --git a/packages/shadcn/src/commands/init.ts b/packages/shadcn/src/commands/init.ts index 641c4f10c0..b261cb0fe5 100644 --- a/packages/shadcn/src/commands/init.ts +++ b/packages/shadcn/src/commands/init.ts @@ -71,7 +71,7 @@ export const init = new Command() .argument("[components...]", "names, url or local path to component") .option( "-t, --template