Skip to content

shadcn/ui Component Collection Integration Plan

Good news: Adding ALL shadcn/ui components to your monorepo is highly feasible and actually recommended for your architecture! Here’s why:

  1. You already have one component (NavigationMenu) successfully integrated
  2. shadcn/ui CLI supports bulk installation with --all flag
  3. Manual approach is manageable (50+ components, but straightforward)
  4. Components are designed for monorepos with clear dependency trees
  5. Storybook integration is proven (your setup already works)

Total Available Components: 50+ UI Components

Section titled “Total Available Components: 50+ UI Components”

Based on shadcn/ui registry analysis:

  1. Accordion - Collapsible content sections
  2. Alert - Contextual feedback messages
  3. Alert Dialog - Modal confirmations
  4. Aspect Ratio - Maintain media proportions
  5. Avatar - User profile images
  6. Badge - Status indicators
  7. Breadcrumb - Navigation path
  8. Button - Primary actions
  9. Button Group - Grouped button actions
  10. Calendar - Date selection (requires react-day-picker)
  11. Card - Content containers
  12. Carousel - Image/content slider
  13. Chart - Data visualization (recharts)
  14. Checkbox - Multi-select inputs
  15. Collapsible - Expandable content
  16. Combobox - Searchable select
  17. Command - Command palette (⌘K)
  18. Context Menu - Right-click menus
  19. Date Picker - Calendar input
  20. Dialog - Modal overlays
  21. Drawer - Slide-in panels
  22. Dropdown Menu - Action menus
  23. Form - Form management (react-hook-form)
  24. Hover Card - Popover on hover
  25. Input - Text input fields
  26. Input OTP - One-time password
  27. Label - Form labels
  28. Menubar - Application menu
  29. Navigation Menu(Already installed!)
  30. Pagination - Page navigation
  31. Popover - Floating content
  32. Progress - Progress bars
  33. Radio Group - Single-select inputs
  34. Resizable - Adjustable panels
  35. Scroll Area - Custom scrollbars
  36. Select - Dropdown selection
  37. Separator - Visual dividers
  38. Sheet - Side panels
  39. Sidebar - Application sidebar (new!)
  40. Skeleton - Loading placeholders
  41. Slider - Range inputs
  42. Sonner - Toast notifications
  43. Spinner - Loading indicators (NEW)
  44. Switch - Toggle switches
  45. Table - Data tables
  46. Tabs - Tabbed interfaces
  47. Textarea - Multi-line text
  48. Toast - Notification toasts
  49. Toggle - Toggle buttons
  50. Toggle Group - Button groups
  51. Tooltip - Hover hints
  • Data Table - Advanced table with sorting, filtering
  • Date Range Picker - Date range selection
  • Multiple Selector - Multi-select input
  • React Hook Form integration
  • Tanstack Form integration

Section titled “Option 1: CLI Bulk Installation (RECOMMENDED)”

Pros:

  • ✅ Fastest method (one command)
  • ✅ Automatically resolves dependencies
  • ✅ Handles peer dependency conflicts
  • ✅ Updates components.json correctly
  • ✅ Can filter by component type

Cons:

  • ⚠️ Installs to single location (not flexible for monorepo structure)
  • ⚠️ May include components you don’t need
  • ⚠️ Requires post-processing to move files

Command:

Terminal window
cd /Users/work-station/company/cloudalt-frontend/packages/ui-web
npx shadcn@latest add --all

What it does:

  • Installs all 50+ components to packages/ui-web/src/components/ui/
  • Adds all dependencies to packages/ui-web/package.json
  • Updates CSS variables (if not already present)
  • Creates Tailwind config extensions

Option 2: Selective Installation (STRATEGIC)

Section titled “Option 2: Selective Installation (STRATEGIC)”

Pros:

  • ✅ Only add what you need
  • ✅ Smaller bundle size
  • ✅ Less maintenance overhead
  • ✅ Clearer component inventory

Cons:

  • ⏱️ Takes more time upfront
  • 🔄 May need to add more later

Recommended Core Set (20 components):

Terminal window
cd /Users/work-station/company/cloudalt-frontend/packages/ui-web
# Navigation & Layout
npx shadcn@latest add breadcrumb sidebar
# Forms & Inputs
npx shadcn@latest add button input textarea checkbox radio-group select switch label
# Feedback & Overlays
npx shadcn@latest add alert dialog sheet toast sonner
# Data Display
npx shadcn@latest add card table badge avatar
# Utilities
npx shadcn@latest add separator skeleton tooltip

Option 3: Manual Collection Installation (CUSTOM)

Section titled “Option 3: Manual Collection Installation (CUSTOM)”

Current approach (what you did with NavigationMenu):

  • Download component code from ui.shadcn.com
  • Place in packages/ui-web/src/[component-name]/
  • Install dependencies manually
  • Create Storybook stories
  • Export from packages/ui-web/src/index.ts

Pros:

  • ✅ Full control over structure
  • ✅ Can customize during installation
  • ✅ Learn component internals
  • ✅ No CLI dependencies

Cons:

  • ⏱️ Very time-consuming (50+ components)
  • ⚠️ Easy to miss dependencies
  • ⚠️ Manual updates required
  • 🔄 Error-prone for complex components

Phase 1: Bulk Install to Temporary Location

Section titled “Phase 1: Bulk Install to Temporary Location”
Terminal window
# Create temporary workspace
mkdir -p /tmp/shadcn-bulk
cd /tmp/shadcn-bulk
# Initialize minimal Next.js project
npx create-next-app@latest . --typescript --tailwind --app --no-src-dir
# Install ALL components via CLI
npx shadcn@latest add --all
# Components now in: components/ui/*
Terminal window
cd /Users/work-station/company/cloudalt-frontend
# Create component categories
mkdir -p packages/ui-web/src/components/{forms,layout,feedback,data,navigation}
# Move components to categories:
# Forms: button, input, textarea, checkbox, radio-group, select, switch, form, label
# Layout: card, separator, sheet, drawer, sidebar, resizable, scroll-area, tabs, collapsible
# Feedback: alert, alert-dialog, dialog, toast, sonner, tooltip, hover-card, popover, progress, skeleton, spinner
# Data: table, badge, avatar, calendar, chart, carousel, aspect-ratio
# Navigation: breadcrumb, navigation-menu, menubar, command, context-menu, dropdown-menu, pagination
packages/ui-web/src/components/forms/index.ts
export * from './button';
export * from './input';
export * from './textarea';
// ... etc
// packages/ui-web/src/index.ts
export * from './components/forms';
export * from './components/layout';
export * from './components/feedback';
export * from './components/data';
export * from './components/navigation';
export * from './lib/utils';

Phase 4: Generate Storybook Stories Programmatically

Section titled “Phase 4: Generate Storybook Stories Programmatically”
Terminal window
# Create script to auto-generate stories
node scripts/generate-shadcn-stories.js

Shared Dependencies (Install Once at Monorepo Root)

Section titled “Shared Dependencies (Install Once at Monorepo Root)”
{
"dependencies": {
"react": "^18.3.1",
"react-dom": "^18.3.1",
"class-variance-authority": "^0.7.1",
"clsx": "^2.1.1",
"tailwind-merge": "^3.3.1",
"lucide-react": "^0.468.0"
}
}
{
"@radix-ui/react-accordion": "^1.2.2",
"@radix-ui/react-alert-dialog": "^1.1.4",
"@radix-ui/react-aspect-ratio": "^1.1.1",
"@radix-ui/react-avatar": "^1.1.2",
"@radix-ui/react-checkbox": "^1.1.3",
"@radix-ui/react-collapsible": "^1.1.2",
"@radix-ui/react-context-menu": "^2.2.4",
"@radix-ui/react-dialog": "^1.1.4",
"@radix-ui/react-dropdown-menu": "^2.1.4",
"@radix-ui/react-hover-card": "^1.1.4",
"@radix-ui/react-label": "^2.1.1",
"@radix-ui/react-menubar": "^1.1.4",
"@radix-ui/react-navigation-menu": "^1.2.14",
"@radix-ui/react-popover": "^1.1.4",
"@radix-ui/react-progress": "^1.1.1",
"@radix-ui/react-radio-group": "^1.2.2",
"@radix-ui/react-scroll-area": "^1.2.2",
"@radix-ui/react-select": "^2.1.4",
"@radix-ui/react-separator": "^1.1.1",
"@radix-ui/react-slider": "^1.2.2",
"@radix-ui/react-slot": "^1.1.1",
"@radix-ui/react-switch": "^1.1.2",
"@radix-ui/react-tabs": "^1.1.2",
"@radix-ui/react-toast": "^1.2.4",
"@radix-ui/react-toggle": "^1.1.1",
"@radix-ui/react-toggle-group": "^1.1.1",
"@radix-ui/react-tooltip": "^1.1.6",
"date-fns": "^4.1.0",
"react-day-picker": "^9.4.3",
"embla-carousel-react": "^8.5.2",
"recharts": "^2.15.0",
"sonner": "^1.7.3",
"react-hook-form": "^7.54.2",
"vaul": "^1.1.2"
}

Total Additional Dependencies: ~35 packages Estimated Bundle Impact: +500KB gzipped (tree-shakeable)


scripts/generate-shadcn-stories.js
const fs = require('fs');
const path = require('path');
const components = [
'accordion', 'alert', 'alert-dialog', 'aspect-ratio', 'avatar',
'badge', 'breadcrumb', 'button', 'button-group', 'calendar',
// ... all 50+ components
];
const template = (componentName, ComponentName) => `
import type { Meta, StoryObj } from '@storybook/react';
import { ${ComponentName} } from '@cloudalt-frontend/ui-web';
const meta: Meta<typeof ${ComponentName}> = {
title: 'ui-web/${ComponentName}',
component: ${ComponentName},
parameters: {
layout: 'centered',
},
tags: ['autodocs'],
};
export default meta;
type Story = StoryObj<typeof ${ComponentName}>;
export const Default: Story = {
args: {},
};
`;
components.forEach(comp => {
const ComponentName = comp.split('-').map(w =>
w.charAt(0).toUpperCase() + w.slice(1)
).join('');
const storyPath = path.join(
__dirname,
'../packages/storybook/stories',
`${ComponentName}.stories.tsx`
);
fs.writeFileSync(storyPath, template(comp, ComponentName));
console.log(`✅ Created story for ${ComponentName}`);
});

  • Day 1: Bulk install (1 hour)
  • Day 2: Organize into categories (3 hours)
  • Day 3: Generate Storybook stories (2 hours)
  • Day 4: Test & fix imports (4 hours)
  • Total: ~10 hours

Option 2: Selective Installation (20 components)

Section titled “Option 2: Selective Installation (20 components)”
  • Day 1: Install core 10 components (2 hours)
  • Day 2: Install remaining 10 components (2 hours)
  • Day 3: Storybook stories (2 hours)
  • Day 4: Testing (2 hours)
  • Total: ~8 hours
Section titled “Option 3: Full Manual Installation (Not Recommended)”
  • Per component: 20-30 minutes average
  • 50 components × 25 minutes = 20+ hours
  • Plus testing & stories: 30+ hours total

Mitigation:

  • Use yarn resolutions for conflicting versions
  • Keep React at single version (^18.3.1)
  • Test each component group before moving to next

Mitigation:

  • Tree-shaking enabled (already in your Nx config)
  • Import only needed components
  • Use dynamic imports for heavy components (Chart, Calendar)

Mitigation:

  • Split stories into sub-packages (@storybook/forms, @storybook/layout)
  • Use Storybook lazy loading
  • Consider separate Storybook instances per category

Mitigation:

  • Pin shadcn/ui component versions
  • Use npx shadcn@latest diff to check for updates
  • Test in isolation before deploying

Why:

  1. You already have infrastructure working (NavigationMenu proves it)
  2. Bulk install saves 20+ hours of manual work
  3. Organized structure maintains monorepo best practices
  4. Storybook automation makes maintenance feasible
  5. Your team gets immediate access to full component library

Next Steps:

  1. Create temporary workspace for bulk installation
  2. Run CLI --all command to get all components
  3. Organize by category in packages/ui-web/
  4. Generate Storybook stories programmatically
  5. Test in one app (homestay) before rolling out
  6. Document component usage in Astro docs site

Timeline: 2-3 days for complete implementation

ROI: 50+ production-ready components vs. 3 days work = Excellent


  1. Do you want ALL 50+ components or a curated set?

    • Recommendation: Start with all, remove unused later
  2. Should components be organized by category or flat structure?

    • Recommendation: Categories (easier to navigate)
  3. Do you want separate Storybook sections per category?

    • Recommendation: Yes (forms, layout, feedback, data, navigation)
  4. Should we create division-specific wrappers now or later?

    • Recommendation: Later (after universal components stabilize)
  5. Do you want automated testing for all components?

    • Recommendation: Yes, but Phase 2 (after integration complete)

  • ✅ All components render in Storybook without errors
  • ✅ No dependency conflicts in yarn install
  • ✅ Bundle size increase < 500KB gzipped
  • ✅ All components importable from @cloudalt-frontend/ui-web
  • ✅ Storybook loads in < 10 seconds
  • ✅ Components work in at least one app (homestay)

Adding all shadcn/ui components is not only feasible but recommended for your CloudAlt monorepo. You’ve already proven the architecture works with NavigationMenu. The bulk installation approach will save significant time while maintaining code quality and organization.

Estimated ROI:

  • Time Investment: 10-15 hours
  • Value Delivered: 50+ production-ready, accessible, customizable components
  • Maintenance Savings: ~100 hours (vs. building from scratch)
  • Developer Velocity: 10x faster UI development

Recommendation: Proceed with implementation! 🚀