Files
new-api/.agents/skills/shadcn-ui/vendor/shadcn/cli.md
T
Calcium-Ion 8b2b03d276 feat(web/default): unified UI overhaul — Base UI migration, theme presets, rankings dashboard, and table toolbar refactor (#4633)
* 🎨 feat(web/default): add shadcn-style theme presets, radius prefs, and fix selection badges

Integrate the qn-platform–style OKLCH color system into the default frontend while keeping the existing blue-tinted dark tokens for the default theme. Add [data-theme-preset] palettes for seven named presets plus the default zinc-like scale, define [data-theme-radius] overrides so user radius beats preset --radius, and align the Tailwind @custom-variant dark helper with .dark usage.

Introduce ThemeCustomizationProvider to own preset and radius state, persist choices in cookies (theme-preset, theme-radius), and sync data-theme-preset / data-theme-radius on <html>. Wrap the tree in main.tsx.

Extend ConfigDrawer with theme preset swatches (scoped data-theme-preset) and radius previews wired to context; refactor swatch/card markup so selected CircleCheck badges sit outside clipped rows (remove outer overflow-hidden that hid the centered checkmark).

Add i18n keys for preset names, radius, and accessibility labels across en, zh, fr, ja, ru, vi.

* 🎨 fix(web): align segmented controls with theme radius tokens

- Replace hard-coded inner pill radii (rounded-[5px]) on dashboard chart
  toolbars with radius-md so the active state follows --radius when users
  change Radius in Theme Settings.
- Use nested radii consistent with TabsList/TabsTrigger: outer
  rounded-lg (var(--radius)) and inner rounded-md (calc(var(--radius) - 2px))
  so the track and active thumb stay concentric at small scales (e.g.
  0.3rem) instead of a squared “focus” block inside a rounded shell.
- Apply the same pattern to pricing SegmentedControl and the segmented
  groups in consumption-distribution-chart, model-charts, and user-charts.

Verified: bun run typecheck (web/default)

*  feat(pricing): enrich model details with uptime sparkline and API documentation

Add a compact 30-day uptime sparkline (OpenRouter-style bars + aggregate %) with
per-day tooltips, surface it in a status row under quick stats and in the
per-group performance table, and extend mock data so uptime series are stable
and optionally scoped by group.

Introduce an API tab with Shiki-highlighted code samples (cURL, Python,
TypeScript, JavaScript), endpoint-type switching, authentication guidance, a
supported-parameters table, and mock per-group RPM/TPM/RPD limits. Infer
vendor, tokenizer, license, and data-retention hints for a provider & data
privacy card on the Overview tab (capabilities/modalities stay with model
identity; rate limits stay with the API tab).

Update i18n for all new user-facing strings across en, zh, fr, ja, ru, and vi.

* 🏆 feat(rankings): add comprehensive rankings dashboard

Add a mock-data powered rankings experience with period tabs, model, app, and vendor leaderboards, market share and history charts, movers, new releases, and per-category sections while backend analytics are pending.

Link ranked models to pricing details and ranked vendors to filtered pricing results, and include localized copy for all supported frontend locales.

* fix(theme): correct theme preset selection state

- update Base UI Radio selectors to use data-checked/data-unchecked states.
- fix unchecked theme options still showing selected indicators.
- isolate the default theme preview tokens to prevent preset changes from leaking into it.

* fix(setup): correct usage mode radio state

- use Base UI data-checked/data-unchecked states for RadioGroup styling.
- hide radio indicators when options are unchecked to avoid setup page display issues.
- drive usage mode card and icon selection styles from Base UI state.

* fix(auth): submit sign-in and sign-up forms

* 🎨 refactor: Align default theme with shadcn Base Nova and prune legacy customization

Migrate shadcn UI to Base UI primitives via CLI (`base-nova` / `components.json`)
and reinstall full component registry with `--overwrite`, including Hugeicons-backed
widgets and newly added registry components.

- Remove custom multi-preset/theme-radius system (`ThemeCustomizationProvider`, cookies,
  preset UI from config drawer); rely on official semantic CSS tokens + light/dark only.
- Replace `theme.css` with shadcn’s documented neutral `:root`/`.dark` palette and
  `@theme inline` mappings (plus skeleton token vars for existing shimmer usage).
- Update global styles for Base UI: collapsible animation uses `--collapsible-panel-height`;
  clarify scroll-lock override comment.

Application compatibility:
- Keep minimal shims where app code diverged from official APIs (popover collision props,
  combobox legacy `options` callers, Spinner prop typing).
- Switch interactive styling from Radix-era `data-state` / `--radix-*` selectors to Base UI
  semantics (`data-open`, `data-popup-open`, `data-panel-open`, `--anchor-width`, etc.)

Tooling / docs / build:
- Rename Rsbuild vendor chunk grouping to `@base-ui` + transitive `@radix-ui`.
- Refresh AGENTS.md / CLAUDE.md / classic→default sync skill for Base UI stack.
- Bump `package.json` / lockfile for shadcn-postinstall deps (Hugeicons, chart stack, themes, etc.)

Verified: `bun run typecheck` passes.

Note: `bun run lint` still reports pre-existing hooks rule violations elsewhere;
not addressed in this change.

* 🎨 chore(web/default): unify table toolbar, relocate usage stats, refine filters

- Refactor DataTableToolbar to a single wrapping flex row with a
  right-aligned action cluster (Reset / Search / View / Expand) for a
  cleaner Ant Design Pro–style filter bar; remove the dedicated stats row
  and the toolbar `stats` prop.
- Move Common Logs summary badges (Usage / RPM / TPM) and the sensitive-
  data visibility toggle into the page header via CommonLogsHeaderActions
  and SectionPageLayout.Actions so the toolbar stays focused on filters.
- Slim CommonLogsFilterBar props (no stats / preActions eye control).
- Improve CompactDateTimeRangePicker: show minute-precision labels on the
  trigger (seconds omitted; aligns with datetime-local inputs); widen the
  trigger on sm+ breakpoints so the full range is visible without truncation;
  apply the same width in task logs filters.
- Simplify DataTableViewOptions: text-only “View” trigger, no sliders icon.
- Earlier layout tweak: extra top padding on SectionPageLayout scroll
  content so control focus rings are not clipped by overflow.

* feat(web/default): Base UI migration and component foundation

Migrate from Radix UI to Base UI, rewrite core UI primitives,
update dependencies (recharts, date-fns, next-themes), add
shadcn agent skill documentation, and refresh AI element components.

This is the foundational work from the v2/localmain lineage that
was not covered by the individual feature commits above.

---------

Co-authored-by: t0ng7u <dev@aiass.cc>
Co-authored-by: QuentinHsu <xuquentinyang@gmail.com>
2026-05-06 12:39:36 +08:00

16 KiB

shadcn CLI Reference

Configuration is read from components.json.

IMPORTANT: Always run commands using the project's package runner: npx shadcn@latest, pnpm dlx shadcn@latest, or bunx --bun shadcn@latest. Check packageManager from project context to choose the right one. Examples below use npx shadcn@latest but substitute the correct runner for the project.

IMPORTANT: Only use the flags documented below. Do not invent or guess flags — if a flag isn't listed here, it doesn't exist. The CLI auto-detects the package manager from the project's lockfile; there is no --package-manager flag.

Contents

  • Commands: init, apply, add (dry-run, smart merge), search, view, docs, info, build
  • Templates: next, vite, start, react-router, astro
  • Presets: named, code, URL formats and fields
  • Switching presets

Commands

init — Initialize or create a project

npx shadcn@latest init [components...] [options]

Initializes shadcn/ui in an existing project or creates a new project (when --name is provided). Optionally installs components in the same step.

Flag Short Description Default
--template <template> -t Template (next, start, vite, next-monorepo, react-router)
--preset [name] -p Preset configuration (named, code, or URL)
--yes -y Skip confirmation prompt true
--defaults -d Use defaults (--template=next --preset=base-nova) false
--force -f Force overwrite existing configuration false
--cwd <cwd> -c Working directory current
--name <name> -n Name for new project
--silent -s Mute output false
--rtl Enable RTL support
--reinstall Re-install existing UI components false
--monorepo Scaffold a monorepo project
--no-monorepo Skip the monorepo prompt

npx shadcn@latest create is an alias for npx shadcn@latest init.

apply — Apply a preset to an existing project

npx shadcn@latest apply [preset] [options]

Applies a preset to an existing project, overwriting preset-driven config, fonts, CSS variables, and detected UI components.

Flag Short Description Default
--preset <preset> Preset configuration (named, code, or URL)
--yes -y Skip confirmation prompt false
--cwd <cwd> -c Working directory current
--silent -s Mute output false

[preset] is a shorthand for --preset <preset>. If both are provided, they must match. If no preset is provided, the CLI offers to open the custom preset builder on ui.shadcn.com/create.

add — Add components

IMPORTANT: To compare local components against upstream or to preview changes, ALWAYS use npx shadcn@latest add <component> --dry-run, --diff, or --view. NEVER fetch raw files from GitHub or other sources manually. The CLI handles registry resolution, file paths, and CSS diffing automatically.

npx shadcn@latest add [components...] [options]

Accepts component names, registry-prefixed names (@magicui/shimmer-button), URLs, or local paths.

Flag Short Description Default
--yes -y Skip confirmation prompt false
--overwrite -o Overwrite existing files false
--cwd <cwd> -c Working directory current
--all -a Add all available components false
--path <path> -p Target path for the component
--silent -s Mute output false
--dry-run Preview all changes without writing files false
--diff [path] Show diffs. Without a path, shows the first 5 files. With a path, shows that file only (implies --dry-run)
--view [path] Show file contents. Without a path, shows the first 5 files. With a path, shows that file only (implies --dry-run)

Dry-Run Mode

Use --dry-run to preview what add would do without writing any files. --diff and --view both imply --dry-run.

# Preview all changes.
npx shadcn@latest add button --dry-run

# Show diffs for all files (top 5).
npx shadcn@latest add button --diff

# Show the diff for a specific file.
npx shadcn@latest add button --diff button.tsx

# Show contents for all files (top 5).
npx shadcn@latest add button --view

# Show the full content of a specific file.
npx shadcn@latest add button --view button.tsx

# Works with URLs too.
npx shadcn@latest add https://api.npoint.io/abc123 --dry-run

# CSS diffs.
npx shadcn@latest add button --diff globals.css

When to use dry-run:

  • When the user asks "what files will this add?" or "what will this change?" — use --dry-run.
  • Before overwriting existing components — use --diff to preview the changes first.
  • When the user wants to inspect component source code without installing — use --view.
  • When checking what CSS changes would be made to globals.css — use --diff globals.css.
  • When the user asks to review or audit third-party registry code before installing — use --view to inspect the source.

npx shadcn@latest add --dry-run vs npx shadcn@latest view: Prefer npx shadcn@latest add --dry-run/--diff/--view over npx shadcn@latest view when the user wants to preview changes to their project. npx shadcn@latest view only shows raw registry metadata. npx shadcn@latest add --dry-run shows exactly what would happen in the user's project: resolved file paths, diffs against existing files, and CSS updates. Use npx shadcn@latest view only when the user wants to browse registry info without a project context.

Smart Merge from Upstream

See Updating Components in SKILL.md for the full workflow.

search — Search registries

npx shadcn@latest search <registries...> [options]

Fuzzy search across registries. Also aliased as npx shadcn@latest list. Without -q, lists all items.

Flag Short Description Default
--query <query> -q Search query
--limit <number> -l Max items per registry 100
--offset <number> -o Items to skip 0
--cwd <cwd> -c Working directory current

view — View item details

npx shadcn@latest view <items...> [options]

Displays item info including file contents. Example: npx shadcn@latest view @shadcn/button.

docs — Get component documentation URLs

npx shadcn@latest docs <components...> [options]

Outputs resolved URLs for component documentation, examples, and API references. Accepts one or more component names. Fetch the URLs to get the actual content.

Example output for npx shadcn@latest docs input button:

base  radix

input
  docs      https://ui.shadcn.com/docs/components/radix/input
  examples  https://raw.githubusercontent.com/.../examples/input-example.tsx

button
  docs      https://ui.shadcn.com/docs/components/radix/button
  examples  https://raw.githubusercontent.com/.../examples/button-example.tsx

Some components include an api link to the underlying library (e.g. cmdk for the command component).

diff — Check for updates

Do not use this command. Use npx shadcn@latest add --diff instead.

info — Project information

npx shadcn@latest info [options]

Displays project info and components.json configuration. Run this first to discover the project's framework, aliases, Tailwind version, and resolved paths.

Flag Short Description Default
--cwd <cwd> -c Working directory current

Project Info fields:

Field Type Meaning
framework string Detected framework (next, vite, react-router, start, etc.)
frameworkVersion string Framework version (e.g. 15.2.4)
isSrcDir boolean Whether the project uses a src/ directory
isRSC boolean Whether React Server Components are enabled
isTsx boolean Whether the project uses TypeScript
tailwindVersion string "v3" or "v4"
tailwindConfigFile string Path to the Tailwind config file
tailwindCssFile string Path to the global CSS file
aliasPrefix string Import alias prefix (e.g. @, ~, @/)
packageManager string Detected package manager (npm, pnpm, yarn, bun)

Components.json fields:

Field Type Meaning
base string Primitive library (radix or base) — determines component APIs and available props
style string Visual style (e.g. nova, vega)
rsc boolean RSC flag from config
tsx boolean TypeScript flag
tailwind.config string Tailwind config path
tailwind.css string Global CSS path — this is where custom CSS variables go
iconLibrary string Icon library — determines icon import package (e.g. lucide-react, @tabler/icons-react)
aliases.components string Component import alias (e.g. @/components)
aliases.utils string Utils import alias (e.g. @/lib/utils)
aliases.ui string UI component alias (e.g. @/components/ui)
aliases.lib string Lib alias (e.g. @/lib)
aliases.hooks string Hooks alias (e.g. @/hooks)
resolvedPaths object Absolute file-system paths for each alias
registries object Configured custom registries

Links fields:

The info output includes a Links section with templated URLs for component docs, source, and examples. For resolved URLs, use npx shadcn@latest docs <component> instead.

build — Build a custom registry

npx shadcn@latest build [registry] [options]

Builds registry.json into individual JSON files for distribution. Default input: ./registry.json, default output: ./public/r.

Flag Short Description Default
--output <path> -o Output directory ./public/r
--cwd <cwd> -c Working directory current

Templates

Value Framework Monorepo support
next Next.js Yes
vite Vite Yes
start TanStack Start Yes
react-router React Router Yes
astro Astro Yes
laravel Laravel No

All templates support monorepo scaffolding via the --monorepo flag. When passed, the CLI uses a monorepo-specific template directory (e.g. next-monorepo, vite-monorepo). When neither --monorepo nor --no-monorepo is passed, the CLI prompts interactively. Laravel does not support monorepo scaffolding.


Presets

Three ways to specify a preset via --preset:

  1. Named: --preset nova or --preset lyra
  2. Code: --preset a2r6bw (version-prefixed base62 string, e.g. a2r6bw or b0)
  3. URL: --preset "https://ui.shadcn.com/init?base=radix&style=nova&..."

IMPORTANT: Never try to decode, fetch, or resolve preset codes manually. Preset codes are opaque — pass them directly to npx shadcn@latest init --preset <code> and let the CLI handle resolution. Use npx shadcn@latest apply --preset <code> when overwriting an existing project's preset.

Switching Presets

Ask the user first: overwrite, merge, or skip existing components?

  • Overwrite / Re-installnpx shadcn@latest apply --preset <code>. Overwrites all detected component files with the new preset styles. Use when the user hasn't customized components.
  • Mergenpx shadcn@latest init --preset <code> --force --no-reinstall, then run npx shadcn@latest info to get the list of installed components and use the smart merge workflow to update them one by one, preserving local changes. Use when the user has customized components.
  • Skipnpx shadcn@latest init --preset <code> --force --no-reinstall. Only updates config and CSS variables, leaves existing components as-is.

Always run preset commands inside the user's project directory. apply only works in an existing project with a components.json file. The CLI automatically preserves the current base (base vs radix) from components.json. If you must use a scratch/temp directory (e.g. for --dry-run comparisons), pass --base <current-base> explicitly — preset codes do not encode the base.