Skip to content

fix: Fix ShadCN UI styles in Nx monorepo with Tailwind v4 #7838

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

naaa760
Copy link

@naaa760 naaa760 commented Jul 16, 2025

#7828

Problem
ShadCN UI components were rendering without styles in our Nx monorepo setup with Tailwind CSS v4 and Next.js 15. The issue was caused by incorrect Tailwind content paths and missing shared UI library structure.

Solution

  • Fixed Tailwind config to properly scan all monorepo directories (apps/, packages/, components/, etc.)
  • Created shared UI package** (packages/ui/) with proper TypeScript configuration and build setup
  • Updated PostCSS config to work correctly with monorepo structure
  • Added workspace dependency and TypeScript path mapping for the UI package
  • Created test page to demonstrate working components with proper styling

Changes

  • tailwind.config.cjs - Updated content paths for monorepo
  • apps/v4/postcss.config.mjs - Added config path reference
  • apps/v4/package.json - Added @workspace/ui dependency
  • apps/v4/tsconfig.json - Added workspace path mapping
  • packages/ui/ - New shared UI package with Button component
  • apps/v4/app/test-ui/page.tsx - Test page showing working components

Testing

Visit /test-ui to see all button variants, sizes, and states working with proper Tailwind v4 styling.

This resolves the issue where ShadCN UI components were unstyled in the monorepo setup.

Copy link

vercel bot commented Jul 16, 2025

@naaa760 is attempting to deploy a commit to the shadcn-pro Team on Vercel.

A member of the Team first needs to authorize it.

@naaa760 naaa760 changed the title fix-shadCN UI styles issue in your Nx monorepo with Tailwind v4 and N… fix: Fix ShadCN UI styles in Nx monorepo with Tailwind v4 Jul 16, 2025
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.

1 participant