Skip to content

React Router

Install Shark UI in a React Router project.

Use the Shark Preset

Create Project

Add Components

You can add components with the CLI or copy them manually from the component docs:

  • CLI: Run npx shadcn@latest add @shark/<component> (e.g. button, dialog).
  • Manual: Copy component source from Manual tab in the component docs.

For example, add the Button component to your project:

You can also install every component at once:

Then import and use components like this:

app/routes/home.tsx

Use the CLI

Create Project

Run the init command to scaffold a new React Router project and configure Shark UI:

For a monorepo project, use the --monorepo flag:

Add Components

You can add components with the CLI or copy them manually from the component docs:

  • CLI: Run npx shadcn@latest add @shark/<component> (e.g. button, dialog).
  • Manual: Copy component source from Manual tab in the component docs.

For example, add the Button component to your project:

If you created a monorepo, run the command from apps/web or specify the workspace from the repo root:

You can also install every component at once:

Then import and use components like this:

app/routes/home.tsx

If you created a monorepo, update apps/web/app/routes/home.tsx and import from your workspace UI package instead.

Existing Project

Create Project

If you need a new React Router project, create one first. Otherwise, skip this step.

Run the CLI

Run the shadcn init command with the Shark preset to set up your project.

Add Components

You can add components with the CLI or copy them manually from the component docs:

  • CLI: Run npx shadcn@latest add @shark/<component> (e.g. button, dialog).
  • Manual: Copy component source from Manual tab in the component docs.

For example, add the Button component to your project:

You can also install every component at once:

Then import and use components like this:

app/routes/home.tsx