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:
- You already have one component (NavigationMenu) successfully integrated
- shadcn/ui CLI supports bulk installation with
--allflag - Manual approach is manageable (50+ components, but straightforward)
- Components are designed for monorepos with clear dependency trees
- Storybook integration is proven (your setup already works)
Component Inventory
Section titled “Component Inventory”Total Available Components: 50+ UI Components
Section titled “Total Available Components: 50+ UI Components”Based on shadcn/ui registry analysis:
Core UI Components (39 confirmed)
Section titled “Core UI Components (39 confirmed)”- Accordion - Collapsible content sections
- Alert - Contextual feedback messages
- Alert Dialog - Modal confirmations
- Aspect Ratio - Maintain media proportions
- Avatar - User profile images
- Badge - Status indicators
- Breadcrumb - Navigation path
- Button - Primary actions
- Button Group - Grouped button actions
- Calendar - Date selection (requires react-day-picker)
- Card - Content containers
- Carousel - Image/content slider
- Chart - Data visualization (recharts)
- Checkbox - Multi-select inputs
- Collapsible - Expandable content
- Combobox - Searchable select
- Command - Command palette (⌘K)
- Context Menu - Right-click menus
- Date Picker - Calendar input
- Dialog - Modal overlays
- Drawer - Slide-in panels
- Dropdown Menu - Action menus
- Form - Form management (react-hook-form)
- Hover Card - Popover on hover
- Input - Text input fields
- Input OTP - One-time password
- Label - Form labels
- Menubar - Application menu
- Navigation Menu ✅ (Already installed!)
- Pagination - Page navigation
- Popover - Floating content
- Progress - Progress bars
- Radio Group - Single-select inputs
- Resizable - Adjustable panels
- Scroll Area - Custom scrollbars
- Select - Dropdown selection
- Separator - Visual dividers
- Sheet - Side panels
- Sidebar - Application sidebar (new!)
- Skeleton - Loading placeholders
- Slider - Range inputs
- Sonner - Toast notifications
- Spinner - Loading indicators (NEW)
- Switch - Toggle switches
- Table - Data tables
- Tabs - Tabbed interfaces
- Textarea - Multi-line text
- Toast - Notification toasts
- Toggle - Toggle buttons
- Toggle Group - Button groups
- Tooltip - Hover hints
Advanced Components
Section titled “Advanced Components”- 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
Installation Approaches
Section titled “Installation Approaches”Option 1: CLI Bulk Installation (RECOMMENDED)
Section titled “Option 1: CLI Bulk Installation (RECOMMENDED)”Pros:
- ✅ Fastest method (one command)
- ✅ Automatically resolves dependencies
- ✅ Handles peer dependency conflicts
- ✅ Updates
components.jsoncorrectly - ✅ 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:
cd /Users/work-station/company/cloudalt-frontend/packages/ui-webnpx shadcn@latest add --allWhat 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):
cd /Users/work-station/company/cloudalt-frontend/packages/ui-web
# Navigation & Layoutnpx shadcn@latest add breadcrumb sidebar
# Forms & Inputsnpx shadcn@latest add button input textarea checkbox radio-group select switch label
# Feedback & Overlaysnpx shadcn@latest add alert dialog sheet toast sonner
# Data Displaynpx shadcn@latest add card table badge avatar
# Utilitiesnpx shadcn@latest add separator skeleton tooltipOption 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
Recommended Strategy: Hybrid Approach
Section titled “Recommended Strategy: Hybrid Approach”Phase 1: Bulk Install to Temporary Location
Section titled “Phase 1: Bulk Install to Temporary Location”# Create temporary workspacemkdir -p /tmp/shadcn-bulkcd /tmp/shadcn-bulk
# Initialize minimal Next.js projectnpx create-next-app@latest . --typescript --tailwind --app --no-src-dir
# Install ALL components via CLInpx shadcn@latest add --all
# Components now in: components/ui/*Phase 2: Organize by Category in Monorepo
Section titled “Phase 2: Organize by Category in Monorepo”cd /Users/work-station/company/cloudalt-frontend
# Create component categoriesmkdir -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, paginationPhase 3: Create Category Exports
Section titled “Phase 3: Create Category Exports”export * from './button';export * from './input';export * from './textarea';// ... etc
// packages/ui-web/src/index.tsexport * 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”# Create script to auto-generate storiesnode scripts/generate-shadcn-stories.jsDependency Management
Section titled “Dependency Management”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" }}Component-Specific Dependencies
Section titled “Component-Specific Dependencies”{ "@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)
Storybook Integration Strategy
Section titled “Storybook Integration Strategy”Auto-Generate Stories Script
Section titled “Auto-Generate Stories Script”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}`);});Timeline & Effort Estimate
Section titled “Timeline & Effort Estimate”Option 1: CLI Bulk + Manual Organization
Section titled “Option 1: CLI Bulk + Manual Organization”- 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
Option 3: Full Manual Installation (Not Recommended)
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
Risks & Mitigation
Section titled “Risks & Mitigation”Risk 1: Dependency Conflicts
Section titled “Risk 1: Dependency Conflicts”Mitigation:
- Use
yarn resolutionsfor conflicting versions - Keep React at single version (^18.3.1)
- Test each component group before moving to next
Risk 2: Bundle Size Bloat
Section titled “Risk 2: Bundle Size Bloat”Mitigation:
- Tree-shaking enabled (already in your Nx config)
- Import only needed components
- Use dynamic imports for heavy components (Chart, Calendar)
Risk 3: Storybook Performance
Section titled “Risk 3: Storybook Performance”Mitigation:
- Split stories into sub-packages (
@storybook/forms,@storybook/layout) - Use Storybook lazy loading
- Consider separate Storybook instances per category
Risk 4: Breaking Changes
Section titled “Risk 4: Breaking Changes”Mitigation:
- Pin shadcn/ui component versions
- Use
npx shadcn@latest diffto check for updates - Test in isolation before deploying
Recommendation
Section titled “Recommendation”✅ Proceed with Hybrid Approach
Section titled “✅ Proceed with Hybrid Approach”Why:
- You already have infrastructure working (NavigationMenu proves it)
- Bulk install saves 20+ hours of manual work
- Organized structure maintains monorepo best practices
- Storybook automation makes maintenance feasible
- Your team gets immediate access to full component library
Next Steps:
- Create temporary workspace for bulk installation
- Run CLI
--allcommand to get all components - Organize by category in
packages/ui-web/ - Generate Storybook stories programmatically
- Test in one app (homestay) before rolling out
- Document component usage in Astro docs site
Timeline: 2-3 days for complete implementation
ROI: 50+ production-ready components vs. 3 days work = Excellent
Questions to Consider
Section titled “Questions to Consider”-
Do you want ALL 50+ components or a curated set?
- Recommendation: Start with all, remove unused later
-
Should components be organized by category or flat structure?
- Recommendation: Categories (easier to navigate)
-
Do you want separate Storybook sections per category?
- Recommendation: Yes (forms, layout, feedback, data, navigation)
-
Should we create division-specific wrappers now or later?
- Recommendation: Later (after universal components stabilize)
-
Do you want automated testing for all components?
- Recommendation: Yes, but Phase 2 (after integration complete)
Success Metrics
Section titled “Success Metrics”- ✅ 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)
Conclusion
Section titled “Conclusion”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! 🚀