Repository navigation
feat(ui): shadcn migration foundation: Tailwind v4, shadcn init, antd cascade fix - #31995
Conversation
… 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
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
Greptile SummaryThis is Phase 1 of the shadcn migration: Tailwind v3 → v4 (CSS-first config in
Confidence Score: 5/5Safe 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.
|
| 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.
…itellm_shadcn_foundation # Conflicts: # litellm/proxy/_experimental/mcp_server/mcp_server_manager.py
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
Relevant issues
Linear ticket
Pre-Submission checklist
Please complete all items before asking a LiteLLM maintainer to review your PR
@greptileaiand received a Confidence Score of at least 4/5 before requesting a maintainer reviewDelays 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), runnpm run devinui/litellm-dashboard, log in at http://localhost:4000/ui, then visit and screenshotnpm run buildpasses, all 4,028 vitest tests pass (4,023 existing plus 5 new Button tests), and the emitted CSS establishes the layer ordertheme, base, antd, components, utilitieswith 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-loadedtailwind.config.ts) is replaced by CSS-first config inglobals.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.jsonwas a build-time-only input to the dying Tremor palette; its brand values are inlined and the file is gone, and the enterpriseenterprise_colors.jsonrebrand path becomes inert until the runtime theming PR replaces it (next in the plan)shadcn init.
components.jsonis hand-authored to the doc's spec (rsc: true,cssVariables: true, permanentbaseColorgray, blank tailwind config) with theutilsalias pointed at the existinglib/cva.config.ts, which now exportscn(cva betacxwith thetwMergehook) instead of addingclass-variance-authorityas a second variant library. The two ad-hoc localcnhelpers fold into it. The canonical gray token set (light and dark) lands inglobals.css;--radiusis 0.5rem so the shadcn radius scale reproduces the Tailwind defaults and every legacyrounded-*class renders unchanged.Buttonships as the canary primitive, adapted to cva beta and React 18forwardRef, with tests pinning the variant classes, twMerge conflict resolution,asChild/Slot, and ref forwardingantd cascade fix. antd v5 injects unlayered CSS-in-JS, which beats every layered Tailwind v4 utility regardless of specificity.
AntdGlobalProvidernow wraps the app inStyleProvider layerplusConfigProvider cssVar, andglobals.cssdeclares@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 migrationAlso gitignores
ui/litellm-dashboard/out/(the rawnext buildexport, previously trackable by accident) and teaches knip about the four deps now referenced only from CSSMerged
litellm_internal_stagingback 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) andnext buildpass on the merged treeAdversarial 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