Skip to content

feat(ui): shadcn migration foundation: Tailwind v4, shadcn init, antd cascade fix - #31995

Merged
ryan-crabbe-berri merged 5 commits into
litellm_internal_stagingfrom
litellm_shadcn_foundation
Jul 3, 2026
Merged

ryan-crabbe-berri merged 5 commits into
litellm_internal_stagingfrom
litellm_shadcn_foundation

Conversation

@ryan-crabbe-berri

@ryan-crabbe-berri ryan-crabbe-berri commented Jul 2, 2026 •

Copy link
Copy Markdown
Contributor

Relevant issues

Linear ticket

Pre-Submission checklist

Please complete all items before asking a LiteLLM maintainer to review your PR

  • I have added meaningful tests
  • My PR passes all CI/CD checks (e.g., lint, format, unit tests)
  • My PR's scope is as isolated as possible; it only solves 1 specific problem
  • I have requested a Greptile review by commenting @greptileai and received a Confidence Score of at least 4/5 before requesting a maintainer review

Delays in PR merge?

If you're seeing a delay in your PR being merged, ping the LiteLLM Team on Slack (#pr-review).

Screenshots / Proof of Fix

I smoke-tested the dev UI at localhost:3000 against a live proxy on localhost:4000 across the heaviest antd + Tremor surfaces and they render unchanged. To reproduce, run the proxy (python litellm/proxy/proxy_cli.py --config litellm/proxy/dev_config.yaml --detailed_debug --reload --use_v2_migration_resolver), run npm run dev in ui/litellm-dashboard, log in at http://localhost:4000/ui, then visit and screenshot

  1. http://localhost:3000/?login=success&page=api-keys (Tremor table, antd toolbar; also click "+ Create New Key" for the antd modal + form)
  2. http://localhost:3000/?login=success&page=teams (antd tabs, pagination, colored badges from the safelisted palette)
  3. http://localhost:3000/?login=success&page=logs (shared DataTable, antd Live Tail switch)
  4. http://localhost:3000/?login=success&page=new_usage (Tremor metric cards, segmented controls, charts)
  5. http://localhost:3000/login (pure antd page)

npm run build passes, all 4,028 vitest tests pass (4,023 existing plus 5 new Button tests), and the emitted CSS establishes the layer order theme, base, antd, components, utilities with the Tremor tokens and safelisted palette classes intact.

Type

🚄 Infrastructure

Changes

Phase 1 (Foundation) of the shadcn migration. Three pieces, per the design doc

Tailwind v3 to v4, CSS-first. The official upgrade codemod renamed utilities across 151 files and the PostCSS pipeline moves to @tailwindcss/postcss. tailwind.config.js (and the dead, never-loaded tailwind.config.ts) is replaced by CSS-first config in globals.css: legacy Tremor theme tokens carry over verbatim into @theme, the Tremor palette safelist becomes @source inline() patterns, and the headlessui/forms plugins load via @plugin. Three v3 preflight behaviors that v4 changed (default border color, button cursor, placeholder color) are pinned so unmigrated pages don't shift. ui_colors.json was a build-time-only input to the dying Tremor palette; its brand values are inlined and the file is gone, and the enterprise enterprise_colors.json rebrand path becomes inert until the runtime theming PR replaces it (next in the plan)

shadcn init. components.json is hand-authored to the doc's spec (rsc: true, cssVariables: true, permanent baseColor gray, blank tailwind config) with the utils alias pointed at the existing lib/cva.config.ts, which now exports cn (cva beta cx with the twMerge hook) instead of adding class-variance-authority as a second variant library. The two ad-hoc local cn helpers fold into it. The canonical gray token set (light and dark) lands in globals.css; --radius is 0.5rem so the shadcn radius scale reproduces the Tailwind defaults and every legacy rounded-* class renders unchanged. Button ships as the canary primitive, adapted to cva beta and React 18 forwardRef, with tests pinning the variant classes, twMerge conflict resolution, asChild/Slot, and ref forwarding

antd cascade fix. antd v5 injects unlayered CSS-in-JS, which beats every layered Tailwind v4 utility regardless of specificity. AntdGlobalProvider now wraps the app in StyleProvider layer plus ConfigProvider cssVar, and globals.css declares @layer theme, base, antd, components, utilities, so antd wins over preflight but yields to utilities. This is what lets migrated shadcn pages and legacy antd pages coexist during the page-by-page migration

Also gitignores ui/litellm-dashboard/out/ (the raw next build export, previously trackable by accident) and teaches knip about the four deps now referenced only from CSS

Merged litellm_internal_staging back in (2026-07-02): resolved the suppressions baseline and the cache_settings modify/delete conflict, confirmed the incoming v3-era code uses no renamed utilities, and cleaned up 178 autofixable UP006/F401 violations in the two Python files staging had pushed past the ruff strict-budget ceiling (a ratchet race between merged PRs), ratcheting the budgets down to match. Full vitest suite (4,042) and next build pass on the merged tree

Adversarial review follow-up (commit c353b5e): Tailwind v4 removed the -opacity- utilities that tremor's precompiled dist still pairs with shade-500 palette classes, which turned Badge/Callout/light-Icon/BarList/ProgressBar tints into solid fills. src/app/tremor-v3-compat.css restores exactly those pairs via color-mix in the utilities layer (verified live: computed backgrounds are 10%-alpha oklab, matching v3). Also converted the two modal scrims the codemod missed (bg-black bg-opacity-30/50 -> bg-black/30, /50) and removed the stale docker/build_admin_ui.sh copy of enterprise_colors.json into the deleted ui_colors.json; the runtime replacement for that rebrand path lands with the theming phase

Add to the verification list above: http://localhost:3000/?login=success&page=models (tremor Badges keep their pastel tints; Icon variant renders) and the top-keys modal on the usage page (scrim is translucent, not solid black)

Second adversarial pass (commit 5a677de) corrected the shim's ring-opacity-40 rows to shade 300: tremor's colorPalette maps ring to 300 and its only ring-opacity-40 consumer (Icon variant outlined, unused in the dashboard today) composes it with that shade, so the 500 rows were dead. It also confirmed the rest holds: cssinjs is deduped so StyleProvider layer applies globally, theme.useToken() consumers get real values (not var() strings) under cssVar, the twMerge hook fires through cn, and the UP006 cleanup is behavior-neutral on requires-python >=3.10

… cascade fix

Upgrade the dashboard from Tailwind v3 to v4 with CSS-first config: the
official upgrade codemod renamed utilities across 151 files, and
tailwind.config.js (plus the dead tailwind.config.ts) is replaced by
@theme tokens, @source globs, and @plugin directives in globals.css. The
Tremor safelist becomes @source inline patterns and the legacy tremor
theme tokens carry over verbatim. ui_colors.json was build-time only and
fed the dying Tremor palette, so its brand values are inlined and the
file removed; runtime theming replaces that path next.

shadcn is initialized with a hand-authored components.json (rsc,
cssVariables, baseColor gray) pointing utils at the existing
lib/cva.config.ts, which now exports cn (cva beta cx + twMerge) instead
of adding class-variance-authority as a second variant library. The two
ad-hoc cn helpers fold into it. Button lands as the canary primitive,
adapted to cva beta and React 18 forwardRef, with tests covering the
variant, twMerge, asChild, and ref seams. --radius is 0.5rem so the
shadcn radius scale reproduces Tailwind defaults and legacy rounded-*
classes render unchanged.

antd v5 emits unlayered CSS-in-JS that would beat every layered v4
utility, so AntdGlobalProvider now wraps the app in StyleProvider layer
and ConfigProvider cssVar, and globals.css declares
@layer theme, base, antd, components, utilities. antd wins over
preflight but yields to utilities, which is what lets migrated shadcn
pages coexist with legacy antd pages. Preflight stays global with the
three v3 behaviors pinned (default border color, button cursor,
placeholder color).
…itellm_shadcn_foundation

# Conflicts:
#	ui/litellm-dashboard/eslint-suppressions.json
#	ui/litellm-dashboard/src/app/(dashboard)/caching/components/cache_settings/CacheFieldRenderer.tsx
@ryan-crabbe-berri

Copy link
Copy Markdown
Contributor Author

@greptileai

@codecov

codecov Bot commented Jul 2, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 93.93939% with 4 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
...oxy/_experimental/mcp_server/mcp_server_manager.py 93.54% 4 Missing ⚠️

📢 Thoughts on this report? Let us know!

@greptile-apps

greptile-apps Bot commented Jul 2, 2026 •

Copy link
Copy Markdown
Contributor

Greptile Summary

This is Phase 1 of the shadcn migration: Tailwind v3 → v4 (CSS-first config in globals.css replacing tailwind.config.js), shadcn init (components.json, Button canary primitive, cn alias on cva.config.ts), and an antd cascade fix (StyleProvider layer + ConfigProvider cssVar in AntdGlobalProvider). A 615-line tremor-v3-compat.css shim restores Tremor's bg-opacity-*/ring-opacity-* compound-class behavior removed in Tailwind v4, and Python files in mcp_server_manager.py and vertex_gemini_transformation.py receive behavior-neutral UP006 type-annotation modernisation.

  • Tailwind v4 CSS-first migration: Tremor theme tokens, the color safelist, and the three v3 preflight pin-backs are carried over faithfully into @theme/@source inline()/@layer base; @ant-design/cssinjs@1.24.0 is deduplicated to a single installed version in the lockfile, confirming no split-brain CSS-in-JS context.
  • shadcn init: components.json sets config: "" for CSS-first Tailwind v4, utils alias points at the existing cva.config.ts which now exports cn = cx (twMerge hook active), and the Button primitive ships with five vitest tests covering variants, conflict resolution, asChild/Slot, and ref forwarding.
  • Missing --destructive-foreground: The :root block and @theme inline mapping omit this variable (standard for shadcn new-york gray); Button works around it with hardcoded text-white, but any future npx shadcn add component (Alert, Toast, Badge) will silently fail on text-destructive-foreground.

Confidence Score: 5/5

Safe to merge; all Tailwind v4 migration mechanics, the antd cascade fix, and the shadcn canary primitive are implemented correctly and the full vitest suite passes.

The Tailwind v3→v4 migration faithfully ports every Tremor theme token, the color safelist, and the three preflight pin-backs. The antd cascade is resolved correctly via StyleProvider layer with a single deduplicated @ant-design/cssinjs instance. The Python changes are pure type-annotation modernization with no logic impact. The only gap is the missing --destructive-foreground CSS variable, which does not affect any currently shipped component but will need to be in place before the next shadcn component is added.

ui/litellm-dashboard/src/app/globals.css — missing --destructive-foreground in :root and @theme inline before adding more shadcn components.

Important Files Changed

Filename Overview
ui/litellm-dashboard/src/app/globals.css CSS-first Tailwind v4 config replacing tailwind.config.js; migrates Tremor theme tokens and safelist into @theme/@source inline(), declares layer order for antd coexistence. Missing --destructive-foreground CSS variable vs. standard shadcn new-york gray palette.
ui/litellm-dashboard/src/app/tremor-v3-compat.css New compat shim restoring Tailwind v3 bg-opacity-* and ring-opacity-* compound-class behavior removed in v4, using color-mix() in the utilities layer.
ui/litellm-dashboard/src/contexts/AntdGlobalProvider.tsx Wraps app in StyleProvider layer and ConfigProvider cssVar to route antd CSS-in-JS into the declared antd cascade layer, preventing unlayered antd styles from overriding Tailwind v4 utilities.
ui/litellm-dashboard/src/components/ui/button.tsx New shadcn Button primitive using cva beta with twMerge hook, React 18 forwardRef, and Slot.Root from radix-ui for asChild polymorphism.
ui/litellm-dashboard/src/lib/cva.config.ts Adds cn = cx export to expose the twMerge-hooked class utility as the shadcn-compatible cn helper, pointed at by the utils alias in components.json.
ui/litellm-dashboard/components.json New shadcn configuration file: new-york style, rsc + cssVariables enabled, empty tailwind config (CSS-first), utils alias pointing to @/lib/cva.config.
ui/litellm-dashboard/package.json Adds @ant-design/cssinjs@1.24.0 (deduplicated to single installed version), radix-ui@1.6.1, @tailwindcss/postcss@4.3.2, tw-animate-css@1.4.0; upgrades tailwindcss to 4.3.2; removes autoprefixer.
litellm/proxy/_experimental/mcp_server/mcp_server_manager.py UP006/UP035 cleanup: Dict→dict, List→list, Set→set, Tuple→tuple throughout type annotations. Behavior-neutral on requires-python >=3.10.
litellm/llms/vertex_ai/image_generation/vertex_gemini_transformation.py Same UP006 type annotation modernization: Dict→dict, List→list in function signatures and local variables. No logic changes.

Reviews (2): Last reviewed commit: "fix(ui): pair ring-opacity-40 with shade..." | Re-trigger Greptile

Tailwind v4 removed the *-opacity-* utilities, but the precompiled
@tremor/react dist still composes them with shade-500 palette classes
(bg-opacity-10 over bg-<color>-500 etc.), so Badge, BadgeDelta, Callout,
light Icon and Button, BarList, and ProgressBar lost their tints and
rendered solid 500-shade fills. Adversarial review caught it; the
original smoke pages only exercised antd Tags.

tremor-v3-compat.css restores exactly the pairs tremor emits: for each
of the 22 safelisted colors, bg-opacity-{10,20,40}, hover/group-hover
bg-opacity-{20,30}, and ring-opacity-{20,40} against the -500 shade,
via color-mix into the utilities layer. Tremor's colorPalette maps both
background and iconRing to 500, so the -500 pairing covers every
composition in the dist; dark: variants are inert until dark mode ships.
The shim dies with @tremor/react at the end of the migration.

The upgrade codemod also missed two hand-rolled modal scrims using
bg-black bg-opacity-{30,50} (solid black under v4); now bg-black/30 and
bg-black/50. Removed the docker/build_admin_ui.sh copy of
enterprise_colors.json into the deleted ui_colors.json; that build-time
rebrand path is retired and its runtime replacement lands with the
theming phase.
Tremor's colorPalette maps ring to shade 300, and the only consumer of
ring-opacity-40 (Icon variant outlined) composes it with that shade,
so the shade-500 rows were dead and outlined icon rings would render
at full opacity. Latent today (no dashboard usage of the outlined
variant); caught by adversarial review. ring-opacity-20 stays at 500
(iconRing), matching Badge and BadgeDelta.
@ryan-crabbe-berri

Copy link
Copy Markdown
Contributor Author

@greptileai

…itellm_shadcn_foundation

# Conflicts:
#	litellm/proxy/_experimental/mcp_server/mcp_server_manager.py
@ryan-crabbe-berri
ryan-crabbe-berri merged commit 27069bd into litellm_internal_staging Jul 3, 2026
76 checks passed
@ryan-crabbe-berri
ryan-crabbe-berri deleted the litellm_shadcn_foundation branch July 3, 2026 02:02
jesus-berri added a commit to BerriAI/litellm-docs that referenced this pull request Nov 13, 2026
The Admin UI stopped reading enterprise_colors.json when the dashboard moved to Tailwind v4 in LiteLLM v1.92.0 (BerriAI/litellm#31995), and the template link 404s since the file moved under litellm/enterprise. Replace the steps with a note under the same anchor and drop color themes from the branding page summaries
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants