Hybrid Dashboard Demo
React + Vue + LARC Components - All Working TogetherThis demo proves LARC's core value proposition: reduce framework overhead by mixing Web Components with React/Vue for a 60%+ smaller bundle.
๐ฏ What This Demonstrates
The Problem
Traditional React dashboards bundle everything:- React + ReactDOM: 172 KB
- Material-UI or Ant Design: 300-500 KB
- Chart library: 100-180 KB
- State management: 20-50 KB
- Total: 600-900 KB before your code
The Solution
Use LARC + selective framework usage:- PAN Core: 5 KB
- React (chart only): 172 KB
- Vue (filters only): 100 KB
- LARC components (on-demand): 45 KB
- Total: ~320 KB (60% savings)
๐๏ธ Architecture
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ PAN Message Bus (5 KB) โ
โโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโค
โ React โ Vue โ LARC โ
โ Component โ Component โ Components โ
โโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโค
โ Analytics โ Filters โ โข Header โ
โ Chart โ Panel โ โข Sidebar โ
โ (172 KB) โ (100 KB) โ โข Stats Cards โ
โ โ โ โข Data Table โ
โ โ โ (45 KB total) โ
โโโโโโโโโโโโโโโดโโโโโโโโโโโโโโโดโโโโโโโโโโโโโโโโโ
Components Breakdown
| Component | Technology | Why? | |-----------|-----------|------| | Header | LARC | Simple, doesn't need framework overhead | | Sidebar | LARC | Static navigation, no complex state | | Stats Cards | LARC | Display-only components | | Filters Panel | Vue | Complex reactive forms (Vue's strength) | | Analytics Chart | React | Rich interactivity (React's strength) | | Data Table | LARC | Standard CRUD operations |
Key Insight: Use frameworks only where they add value. For 80% of UI (cards, tables, modals), LARC is enough.๐ PAN Message Bus Coordination
All three technologies communicate via PAN messages:
// Vue publishes filter changes
filters:changed โ { dateRange: '7d', metric: 'users' }
// React chart receives and updates
// LARC table receives and re-filters
// No tight coupling between components!
Without PAN: Each component would need custom integration code, negating reusability.
With PAN: Components are truly independent and composable.
๐ Running the Demo
Option 1: Local Development
# From repo root
python3 -m http.server 8000
# Open browser
open http://localhost:8000/examples/hybrid-dashboard/
Option 2: GitHub Pages
Once deployed: https://larcjs.com/examples/hybrid-dashboard/
๐ Bundle Size Comparison
The demo shows a real-time comparison banner at the top:
Traditional React Approach
React + ReactDOM: 172 KB
Material-UI: 450 KB
Chart.js + wrapper: 180 KB
State Management: 35 KB
โโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Total: 837 KB โ
Hybrid LARC Approach
PAN Core Bus: 5 KB
React (chart only): 172 KB
Vue (filters only): 100 KB
LARC Components: 45 KB
โโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Total: 322 KB โ
Savings: 515 KB (61% smaller)
๐จ Features Demonstrated
1. Framework Interoperability
- React component renders chart
- Vue component renders filters
- LARC components render everything else
- All coordinate via PAN messages
2. Loose Coupling
- No component imports another
- No prop drilling
- No shared state managers
- Just topic-based messaging
3. Theme Coordination
- Click "Toggle Theme" in header
- All components update (React, Vue, LARC)
- Demonstrates cross-framework state sync
4. Data Flow
- Vue filters publish changes
- React chart receives and updates
- LARC table receives and re-filters
- Click chart datapoints โ publishes event
๐ก Key Takeaways
When to Use Each Technology
Use LARC for:- โ Cards, modals, dropdowns, tabs
- โ Data tables (sorting, filtering, pagination)
- โ Navigation, sidebars, headers
- โ Forms (unless extremely complex)
- โ Static display components
- ๐ง Rich interactive charts/visualizations
- ๐ง Complex multi-step wizards
- ๐ง Real-time collaborative features
- ๐ง Heavy client-side business logic
- ๐ง Complex reactive forms
- ๐ง Admin panels with lots of inputs
- ๐ง Dynamic filter/search UIs
๐งช Testing PAN Coordination
Experiment 1: Filter Changes
๐ React Chart received filter changeExperiment 2: Chart Interaction
๐ Chart datapoint clickedExperiment 3: Theme Toggle
๐ File Structure
hybrid-dashboard/
โโโ index.html # Main page with dashboard layout
โโโ react-chart.js # React component (analytics chart)
โโโ vue-filters.js # Vue component (filters panel)
โโโ README.md # This file
๐ Learning Goals
After exploring this demo, you should understand:
๐ Related Demos
- Pure LARC Dashboard - Compare bundle size with no frameworks
- React Integration Example - Deep dive on React + PAN
- Vue Integration Example - Deep dive on Vue + PAN
๐ค Contributing
Want to add more framework examples?
- Angular integration
- Svelte integration
- Solid integration
Built to prove a point: Web Components + PAN messaging can reduce real-world bundle sizes by 60%+, while keeping the power of React/Vue where you need it.