Build an Analytics Dashboard with Sidebar, KPI Cards and SVG Charts in One HTML File
A responsive store analytics dashboard with a collapsible sidebar, four KPI cards with sparklines, and hand-drawn SVG line, donut and bar charts.
The prompt
Act as a senior product designer who writes clean, accessible front-end code. Build Harbor Metrics, a store analytics dashboard for a fictional coffee roaster, Tidewater Supply Co., as one HTML page. Layout: a dark collapsible sidebar with a brand mark and five icon nav links; a top bar with a sidebar toggle, page title, date range line and a 7 / 30 / 90 day segmented control; four KPI cards (revenue, orders, conversion rate, average order value), each with a delta vs the prior period and a sparkline; a revenue line chart against the prior period; a traffic-sources donut; an orders-by-channel bar chart; and a recent orders table. Rules: 1) Draw every chart by hand in inline SVG from seeded, plausible sample data, and regenerate all figures when the range changes. 2) The line chart shows a crosshair tooltip on hover or touch, is keyboard focusable, steps through points with arrow keys and announces values in an aria-live region. 3) The sidebar collapses to an icon rail on desktop and becomes an off-canvas drawer with a scrim under 760px. Escape closes it and aria-expanded stays accurate. 4) Reflow from 360 to 1280px: 4, then 2, then 1 KPI columns. Charts redraw at their real width so labels stay legible. 5) Use slate ink, one blue accent plus four supporting hues, system fonts, rounded cards and tabular numbers. 6) Use no external assets or storage, and respect prefers-reduced-motion. Output format: one complete HTML file in a single code block, then 3 short ideas to extend it.Example output
Tips and common edits
Why this works
- Seeded sample data gives believable, repeatable numbers, so the charts look real and stay consistent between range switches.
- Charts redraw at their container's pixel width, so axis labels stay readable on 360px phones instead of shrinking.
- Exact breakpoints, drawer behavior and ARIA rules leave the model nothing to guess, so the layout and toggle work on the first try.
Paste into ChatGPT, Claude or Gemini. Save the reply's code as dashboard.html and open it in any browser, or view it in the chat's preview or canvas. Resize the window to check the phone layout.
Common edits
- Swap the business, metric names and channel labels for a SaaS, newsletter or fitness brand, and change the accent hex for a new theme.
- Add a dark mode toggle that flips the CSS variables, or add a fifth KPI card for refunds or churn.
Prompt details
- By
- Prompts-GPT editors
- Published
Keep exploring
More like this
Build a Sortable, Filterable Data Table with Pagination in One HTML File
A polished vanilla JavaScript orders table with column sorting, live search, status filters, row selection with bulk actions, pagination and an empty state, all in one HTML file.
Build a Color Blindness Simulator That Previews a Palette on a Dashboard Card
A single HTML file that redraws a realistic dashboard card under protanopia, deuteranopia, tritanopia and grayscale and flags color pairs that become hard to tell apart.
Build a Multi-Step Onboarding Wizard with Stepper and Inline Validation
A four-step onboarding wizard in one HTML file, with a clickable stepper, progress bar, inline validation, a review screen, and keyboard and swipe navigation.
Build a Playful Animated 404 Error Page with SVG Art and Site Search
A complete single-file 404 page with an original animated hot-air balloon SVG, a live-filtering search box and helpful recovery links that respect reduced motion.
Build a Responsive Navigation Bar With Mega Menu and Mobile Drawer in HTML
A complete single-file site header with a hover, click and arrow-key mega menu on desktop and an animated hamburger drawer with accordions on small screens.
Build a Responsive Three-Tier Pricing Section with Monthly/Yearly Toggle
A single HTML file with three pricing cards, a working billing switch that recalculates prices, a highlighted recommended plan and accessible feature checkmarks.
- Build a SaaS Landing Page Hero with a CSS-Drawn Product Mockup
- Build an Accessible Modal, Toast and Tooltip Showcase in One HTML File
- Build an Empty States and Loading Skeletons Gallery in One HTML File
- Build an Interactive Habit Tracker Mobile App Prototype in One HTML File
- Build a Light/Dark Mode Toggle Demo Page with Smooth Theme Switching
- Build a Sticky-Header Plan Comparison Page with Swipeable Mobile Columns