Create an interactive analytics dashboard for SaaS metrics aimed at Business owners.…
- User
Create an interactive analytics dashboard for SaaS metrics aimed at Business owners. Include KPI summary cards with trend indicators, a mix of line, bar, and donut charts with hover tooltips and smooth transitions, a sortable and filterable data table, and date-range and segment filters that update every view live. Use a clean, modern visual style with clear layout hierarchy and a dark mode toggle, generate realistic sample data so every chart feels alive, and make it fully responsive.
Assistant
I'll build a comprehensive SaaS analytics dashboard. Let me start by exploring the project structure, then install dependencies and create all the components.
Now let me install Recharts for the charts and Lucide React for icons:
Now I'll update the index.html title and create all the files. Let me start with the data layer and work up:
Now let me create the data generation module:
Now let me create the theme context for dark mode:
Now let me create the filter context:
Now let me create the components. Starting with the header:
Now the filters bar:
Now the KPI cards:
Now the MRR line chart:
Now let's create the revenue bar chart:
Now the donut chart:
Let me fix the Pie chart type issue - the Recharts API might have changed:
Now let's create the customer growth chart:
Now let's create the data table component:
Now let's create the DAU sparkline chart:
Now let's create the churn analysis chart:
Now let's put it all together in the App component:
Now let's update the CSS to support dark mode and add some nice defaults:
Now let's build and see if everything compiles:
The project builds successfully. Let me verify the output is clean by checking for any remaining issues:
The build is successful. Here's a summary of what I created:
SaaS Metrics Dashboard — "MetricFlow"
Architecture (17 files across 5 directories)
Data Layer (
src/data/)- generateData.ts — Generates 24 months of realistic SaaS data using seeded randomness for deterministic results: MRR trends with seasonality & noise, customer growth/churn, revenue by segment, 50 named customer accounts, and 90 days of daily active users
Context Layer (
src/context/)- ThemeContext.tsx — Dark mode toggle (auto-detects system preference, toggles
darkclass on<html>) - FilterContext.tsx — Global filters for date range (3M/6M/1Y/2Y) and segment selection (Enterprise, Mid-Market, SMB, Startup) that cascade to every chart and table
Components (
src/components/)- Header.tsx — Sticky navbar with logo, live indicator badge, and dark mode toggle with animated icon
- FilterBar.tsx — Date-range toggle pills and segment filter buttons that update all views live
- KPICards.tsx — 6 KPI summary cards (MRR, ARR, Customers, Churn Rate, ARPU, NRR) with trend indicators (↑/↓), color-coded icons, and hover elevation effects
- DataTable.tsx — Fully sortable (click any column header), searchable, filterable data table with status badges, health score bars, pagination
Charts (
src/components/charts/)- MRRChart.tsx — Stacked area chart showing MRR trend per segment with gradient fills and smooth animations
- RevenueBarChart.tsx — Grouped bar chart showing New/Expansion/Churned MRR breakdown by segment
- SegmentDonutChart.tsx — Interactive donut chart with active-slice expansion on hover, showing revenue distribution
- CustomerGrowthChart.tsx — Composed chart combining a line (total customers) with bars (new/churned)
- ChurnChart.tsx — Multi-line chart tracking churn rate trends per segment
- DAUChart.tsx — 30-day sparkline area chart with WoW change indicator
Features
- 🌗 Dark mode toggle with system-preference detection
- 📊 6 interactive charts (area, bar, composed, donut, line) with hover tooltips and smooth 800ms transitions
- 📋 Sortable/filterable table with search, status filter, pagination, and health score bars
- 🎯 Live global filters — date range and segment selectors update every view instantly
- 📱 Fully responsive — works from mobile to ultrawide (1600px max)
- 🎨 Clean visual hierarchy — consistent card styling, subtle gradients, balanced spacing
Files built:
index.html,src/data/generateData.ts,src/context/ThemeContext.tsx,src/context/FilterContext.tsx,src/components/Header.tsx,src/components/FilterBar.tsx,src/components/KPICards.tsx,src/components/charts/MRRChart.tsx,src/components/charts/RevenueBarChart.tsx,src/components/charts/SegmentDonutChart.tsx,src/components/charts/CustomerGrowthChart.tsx,src/components/DataTable.tsx,src/components/charts/DAUChart.tsx,src/components/charts/ChurnChart.tsx,src/App.tsx,src/index.css
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.