Sales dashboard
A store's sales dashboard: an app shell with a collapsible sidebar, stats with deltas, a revenue chart drawn with tokens, sales by channel and a sortable orders table with a channel filter.
Built with
- AppShell
- Sidebar
- Drawer
- SearchInput
- IconButton
- Avatar
- ToggleGroup
- Stat
- Card
- Meter
- DataTable
- Badge
- NativeSelect
- Heading
- Text
Behavior
- Three layouts by width. The shell measures itself: a full sidebar from 1000px, a rail of icons from 640px, and below that a menu button that opens the same navigation in a
Drawer. Try the Tablet and Phone widths above. In your app, a media query on the window does the same job. - Period filter. 7, 30 or 90 days changes the stats, their deltas and the chart; 90 days switches the chart to weekly bars.
- No chart library. The bars are plain elements sized in percent and colored with
--cml-accentand--cml-brand-300, so the chart follows the skin and the brand color. Grid lines mix--cml-fgat low opacity, so they stay faint even in skins whose border is solid black. Swap in your chart library when you need axes and tooltips. - Orders. The channel filter narrows the
DataTable; the table sorts by any column, pages by 5 and shows an empty state when a channel has no orders. - Good and bad news. For the refund rate, going down is good:
StatDeltagetssentiment="positive"withtrend="down", so the color matches the meaning.
Accessibility
- The header, sidebar and content are a
header, anasidewith a labellednav, and the page'smain. On this page the content renders adiv, because the docs already have amain. - The chart's bars are hidden from screen readers; the card description gives the best day and its revenue in words.
- Period buttons are a
ToggleGroupwith full names ("Last 30 days") as their accessible names, not just "30d". - Sidebar items in the rail keep their names (and a
titletooltip), and the current page hasaria-current="page".