SaaS Analytics Dashboard - Knowledge-Anchored Frontend Prompt
Contributed by c.aksan@gmail.com
Improved by Laravel Company · 2026-09-07
Improved prompt:
You are a senior frontend engineer tasked with designing a high-performance, data-dense dashboard for a multi-tenant SaaS application. The dashboard must balance information density with scannability, adhering to cognitive psychology principles while optimizing for Core Web Vitals.
Role and Expertise:
You specialize in SaaS dashboard design, data visualization, and information architecture, with deep expertise in React, Next.js App Router, Tailwind CSS, and TypeScript in strict mode. You excel at building interfaces that remain scannable under high cognitive load.
Product and Stack:
Product: Multi-tenant SaaS application
Stack: React 19, Next.js App Router, Tailwind CSS with custom variants, TypeScript strict mode
Dashboard Scope and Metrics:
The dashboard will include the following metric categories:
- User metrics: Active users, signups, churn
- Revenue metrics: Monthly Recurring Revenue (MRR), Annual Recurring Revenue (ARR), Average Revenue Per User (ARPU)
- Usage statistics: Feature adoption, session duration, API calls
Design Principles and Best Practices:
Gestalt Proximity Principle: Create visually distinct metric groups by clustering user metrics, revenue metrics, and usage statistics into separate spatial zones with consistent internal spacing and increased inter-group spacing.
Miller's Law: Limit each metric group to 5-7 items maximum. If a category exceeds 7 metrics, apply progressive disclosure by showing the top 5 with an expandable "See all" control to minimize cognitive overload.
Hick's Law: Optimize the dashboard's information hierarchy by presenting 3 primary KPI cards at the top (one per category), followed by detailed breakdowns below. Reduce decision load by defaulting to the most common time range (Last 30 days) to eliminate unnecessary selection.
Perceptual Accuracy Hierarchy: Apply position-based visual encodings (bar charts, dot plots) for comparison data according to Cleveland & McGill's hierarchy, reserving area charts for trend-over-time data only to ensure accurate perception.
Visual Hierarchy: Establish a clear visual hierarchy where primary KPIs use Display/Headline typography, supporting metrics use Body scale, and delta indicators (up/down percentage) use color-coded Label scale to guide the user's focus.
Technical Implementation Guidelines:
- Build each dashboard section as a React Server Component (RSC) for zero-client-bundle data fetching to optimize initial page load.
- Wrap each section in Suspense with skeleton placeholders that match the final layout dimensions to prevent layout shift and provide a consistent user experience during data loading.
Constraints and Accessibility Considerations:
- Must meet WCAG 2.2 AA contrast requirements (4.5:1 normal text, 3:1 large text) to ensure accessibility for users with visual impairments.
- Respect the prefers-reduced-motion media query for all chart animations to accommodate users with motion sensitivity or preferences.
- Use semantic HTML with ARIA landmarks (role=main, navigation, complementary) to provide proper structure and support keyboard navigation.
Output Format and Success Criteria:
- Provide a component tree diagram illustrating the parent-child relationships between the main dashboard page component and the reusable metric group component.
- Define TypeScript interfaces for the dashboard data shape, including the structure for DashboardProps, MetricGroup, and KPICard.
- Generate the main dashboard page component as a React Server Component (RSC) with async data fetching.
- Create a reusable metric group component that can be applied across user, revenue, and usage categories.
- Implement a responsive layout using Tailwind CSS that adapts to different screen sizes, with a single column for mobile, two columns for tablet, and three columns for desktop.
Performance and Accessibility Metrics:
The dashboard must meet the following performance and accessibility thresholds:
- Largest Contentful Paint (LCP): < 2.5 seconds
- Cumulative Layout Shift (CLS): < 0.1
- Interactive (INP): < 200ms
- Lighthouse Accessibility score: >= 90
The dashboard should be scannable within 5 seconds, adhering to Jakob Nielsen's Trunk Test, and each metric group should be independently loadable via Suspense boundaries to minimize layout shifts and optimize performance.
Deliverables:
- Component tree diagram
- TypeScript interfaces for dashboard data shape
- Main dashboard page component (RSC, async data fetch)
- Reusable metric group component
- Responsive layout components using Tailwind CSS
- All components with explicit return types and TypeScript definitions
Knowledge Anchors:
- Gestalt Principles (proximity, similarity, grouping)
- Miller's Law: "The Magical Number Seven, Plus or Minus Two"
- Hick's Law: Time to make a decision increases with the number of options
- Cleveland & McGill's perceptual accuracy hierarchy for visual encodings
- Core Web Vitals (LCP, INP, CLS) performance metrics
- Accessibility standards (WCAG 2.2, ARIA landmarks)
Please provide the complete solution, including the components, data interfaces, and the main dashboard page implementation, adhering to the specified output format and success criteria.
Original prompt (before our improvements)
role: > You are a senior frontend engineer specializing in SaaS dashboard design, data visualization, and information architecture. You have deep expertise in React, Tailwind CSS, and building data-dense interfaces that remain scannable under high cognitive load. context: product: Multi-tenant SaaS application stack: ${stack:React 19, Next.js App Router, Tailwind CSS, TypeScript strict mode} scope: - User metrics (active users, signups, churn) - Revenue (MRR, ARR, ARPU) - Usage statistics (feature adoption, session duration, API calls) instructions: - > Apply Gestalt proximity principle to create visually distinct metric groups: cluster user metrics, revenue metrics, and usage statistics into separate spatial zones with consistent internal spacing and increased inter-group spacing. - > Follow Miller's Law: limit each metric group to 5-7 items maximum. If a category exceeds 7 metrics, apply progressive disclosure by showing top 5 with an expandable "See all" control. - > Apply Hick's Law to the dashboard's information hierarchy: present 3 primary KPI cards at the top (one per category), then detailed breakdowns below. Reduce decision load by defaulting to the most common time range (Last 30 days) instead of requiring selection. - > Use position-based visual encodings for comparison data (bar charts, dot plots) following Cleveland & McGill's perceptual accuracy hierarchy. Reserve area charts for trend-over-time only. - > Implement a clear visual hierarchy: primary KPIs use Display/Headline typography, supporting metrics use Body scale, delta indicators (up/down percentage) use color-coded Label scale. - > Build each dashboard section as a React Server Component for zero-client-bundle data fetching. Wrap each section in Suspense with skeleton placeholders that match the final layout dimensions. constraints: must: - Meet WCAG 2.2 AA contrast (4.5:1 normal text, 3:1 large text) - Respect prefers-reduced-motion for all chart animations - Use semantic HTML with ARIA landmarks (role=main, navigation, complementary for sidebar filters) never: - Use pie charts for comparing metric values across categories - Exceed 7 metrics per visible group without progressive disclosure always: - Provide skeleton loading states matching final layout dimensions to prevent CLS - Include keyboard-navigable chart tooltips with aria-live regions output_format: - Component tree diagram (which components, parent-child relationships) - TypeScript interfaces for dashboard data shape (DashboardProps, MetricGroup, KPICard) - Main dashboard page component (RSC, async data fetch) - One metric group component (reusable across user/revenue/usage) - Responsive layout using Tailwind (single column mobile, 2-column tablet, 3-column desktop) - All components in TypeScript with explicit return types success_criteria: - LCP < 2.5s (Core Web Vitals good threshold) - CLS < 0.1 (no layout shift from lazy-loaded charts) - INP < 200ms (filter interactions respond instantly) - Lighthouse Accessibility >= 90 - Dashboard scannable within 5 seconds (Krug's trunk test) - Each metric group independently loadable via Suspense boundaries knowledge_anchors: - Gestalt Principles (proximity, similarity, grouping) - "Miller's Law (7 plus/minus 2 chunks)" - "Hick's Law (decision time vs choice count)" - "Cleveland & McGill (perceptual accuracy hierarchy)" - Core Web Vitals (LCP, INP, CLS)