Skip to content

Installation

Set up a project with the shadcn CLI, then add components to it.

New project

This creates a Vite app with the theme, the Inter and Geist Mono fonts, cn and cva in lib/utils.ts, the @jarvis registry and a Button. List more components after @jarvis/button to add them too.

Existing project

Leave out -t vite to set up an existing Vite or Next.js app instead.

If the project already uses the shadcn CLI with Base UI, add the registry instead.

Adding components

Add components by name.

In a project that only added the registry, the first component you add replaces lib/utils.ts with a version that exports cva alongside cn. Let the CLI overwrite the file when it asks. After init, lib/utils.ts already exports cva.

You can also pass a component's page URL, as in shadcn add https://ui.jarv.is/components/button.

Usage

The CLI adds components to components/ui.

components/save-button.tsx

Stacking

Dialogs, menus and other popups render at the end of <body>, above anything on the page with a z-index below 50. To keep every z-index on the page beneath them, wrap the app in an element with isolation: isolate, as Base UI recommends.

app/layout.tsx

In a Vite app, add class="isolate" to the #root element in index.html instead.