# Dashboard

> Part of Tray UI 0.2.0, a design system in plain HTML and CSS (MIT licence). Every page: https://trayui.com/llms.txt

An app's home: a sidebar with a workspace switcher, four stat cards, a chart of orders per day and a table of the latest orders to select and sort.

It is made of these components: [App Shell](https://trayui.com/components/app-shell.md), [Sidebar](https://trayui.com/components/sidebar.md), [Dropdown Menu](https://trayui.com/components/dropdown-menu.md), [Workspace Switcher](https://trayui.com/components/workspace-switcher.md), [Avatar](https://trayui.com/components/avatar.md), [Badge](https://trayui.com/components/badge.md), [Usage Meter](https://trayui.com/components/usage-meter.md), [Progress](https://trayui.com/components/progress.md), [Top Bar](https://trayui.com/components/top-bar.md), [Button](https://trayui.com/components/button.md), [Breadcrumb](https://trayui.com/components/breadcrumb.md), [Kbd](https://trayui.com/components/kbd.md), [Page Header](https://trayui.com/components/page-header.md), [Stat Card](https://trayui.com/components/stat-card.md), [Card](https://trayui.com/components/card.md), [Chart](https://trayui.com/components/chart.md), [Toggle Group](https://trayui.com/components/toggle-group.md), [Data Table](https://trayui.com/components/data-table.md), [Input Group](https://trayui.com/components/input-group.md), [Input](https://trayui.com/components/input.md), [Table](https://trayui.com/components/table.md), [Checkbox](https://trayui.com/components/checkbox.md), [Empty](https://trayui.com/components/empty.md).

Behaviours it uses: `chart`, `datatable`, `menu`, `sidebar-sheet`, `sidebar-toggle`.

Copy the page into a project that links `tokens.css`, `components/bundle.css` and `components/bundle.js`; the paths in its `<head>` assume it sits one folder below them.

```html
<!doctype html>
<html lang="en" data-theme="light">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Dashboard</title>
<meta name="description" content="An app's home: a sidebar with a workspace switcher, four stat cards, a chart of orders per day and a table of the latest orders to select and sort.">
<meta name="tray-category" content="Dashboard">
<link rel="stylesheet" href="../tokens.css">
<link rel="stylesheet" href="../components/bundle.css">
</head>
<body>
<div class="tray-app">
  <div class="tray-app__side">
    <nav class="tray-sidebar" id="nav" aria-label="Main">
      <div class="tray-sidebar__head" style="padding-inline: 0">
        <div class="tray-anchor tray-anchor--block" data-tray="menu">
          <button class="tray-switcher" type="button"><span class="tray-avatar tray-avatar--sm tray-avatar--ink" aria-hidden="true">PF</span><span class="tray-person__text"><b>Perly Farm</b><small>Shop plan</small></span><svg class="tray-icon" aria-hidden="true"><use href="#tray-i-chevrons-up-down"/></svg></button>
          <div class="tray-pop">
            <div class="tray-list">
              <p class="tray-list__label">Workspaces</p>
              <button class="tray-option" type="button" role="menuitemradio" data-group="workspace" aria-checked="true"><span class="tray-avatar tray-avatar--xs tray-avatar--ink" aria-hidden="true">PF</span><span class="tray-option__text">Perly Farm</span><svg class="tray-icon tray-option__check" aria-hidden="true"><use href="#tray-i-check"/></svg></button>
              <button class="tray-option" type="button" role="menuitemradio" data-group="workspace" aria-checked="false"><span class="tray-avatar tray-avatar--xs" aria-hidden="true">MB</span><span class="tray-option__text">Meadow Bakery</span><svg class="tray-icon tray-option__check" aria-hidden="true"><use href="#tray-i-check"/></svg></button>
              <button class="tray-option" type="button" role="menuitemradio" data-group="workspace" aria-checked="false"><span class="tray-avatar tray-avatar--xs" aria-hidden="true">HC</span><span class="tray-option__text">Hill Cheese</span><svg class="tray-icon tray-option__check" aria-hidden="true"><use href="#tray-i-check"/></svg></button>
              <hr class="tray-list__rule">
              <button class="tray-option" type="button" role="menuitem"><svg class="tray-icon" aria-hidden="true"><use href="#tray-i-plus"/></svg><span class="tray-option__text">New workspace</span></button>
            </div>
          </div>
        </div>
      </div>
      <div class="tray-sidebar__group">
        <a class="tray-sidebar__item" href="#" aria-current="page"><svg class="tray-icon" aria-hidden="true"><use href="#tray-i-house"/></svg><span>Home</span></a>
        <a class="tray-sidebar__item" href="#"><svg class="tray-icon" aria-hidden="true"><use href="#tray-i-inbox"/></svg><span>Orders</span><span class="tray-badge tray-badge--count">12</span></a>
        <a class="tray-sidebar__item" href="#"><svg class="tray-icon" aria-hidden="true"><use href="#tray-i-users"/></svg><span>Customers</span></a>
        <a class="tray-sidebar__item" href="#"><svg class="tray-icon" aria-hidden="true"><use href="#tray-i-package"/></svg><span>Batches</span></a>
        <a class="tray-sidebar__item" href="#"><svg class="tray-icon" aria-hidden="true"><use href="#tray-i-chart-column"/></svg><span>Reports</span></a>
      </div>
      <div class="tray-sidebar__group">
        <p class="tray-sidebar__label">Workspace</p>
        <a class="tray-sidebar__item" href="#"><svg class="tray-icon" aria-hidden="true"><use href="#tray-i-user-plus"/></svg><span>Team</span></a>
        <a class="tray-sidebar__item" href="#"><svg class="tray-icon" aria-hidden="true"><use href="#tray-i-credit-card"/></svg><span>Billing</span></a>
        <a class="tray-sidebar__item" href="#"><svg class="tray-icon" aria-hidden="true"><use href="#tray-i-plug"/></svg><span>Integrations</span></a>
        <a class="tray-sidebar__item" href="#"><svg class="tray-icon" aria-hidden="true"><use href="#tray-i-settings"/></svg><span>Settings</span></a>
      </div>
      <div class="tray-sidebar__foot">
        <div class="tray-usage tray-usage--sm" style="flex: 1">
          <div class="tray-progress">
            <span class="tray-progress__name">Orders</span>
            <span class="tray-progress__value">842 of 1,000</span>
            <span class="tray-progress__bar" role="meter" aria-label="Orders this month" aria-valuemin="0" aria-valuemax="1000" aria-valuenow="842" style="--tray-v: 84"></span>
          </div>
          <a class="label" href="#">Upgrade the plan</a>
        </div>
      </div>
    </nav>
  </div>
  <div class="tray-app__main">
    <header class="tray-topbar">
      <div class="tray-topbar__start">
        <button class="tray-btn tray-btn--quiet tray-btn--sm tray-btn--icon tray-app__menu" type="button" data-tray="sidebar-sheet" aria-controls="nav" aria-label="Open the navigation"><svg class="tray-icon" aria-hidden="true"><use href="#tray-i-menu"/></svg></button>
        <button class="tray-btn tray-btn--ghost tray-btn--xs tray-btn--icon tray-app__collapse" type="button" data-tray="sidebar-toggle" aria-controls="nav" aria-label="Collapse the sidebar"><svg class="tray-icon" aria-hidden="true"><use href="#tray-i-panel-left"/></svg></button>
        <nav aria-label="Breadcrumb"><ol class="tray-crumbs tray-crumbs--fold"><li><a href="#">Perly Farm</a></li><li><span aria-current="page">Home</span></li></ol></nav>
      </div>
      <div class="tray-topbar__end">
        <button class="tray-topbar__search tray-topbar__search--fold" type="button" aria-label="Search orders" aria-keyshortcuts="/"><svg class="tray-icon" aria-hidden="true"><use href="#tray-i-search"/></svg><span>Search orders</span><kbd class="tray-kbd">/</kbd></button>
        <span class="tray-anchor"><button class="tray-btn tray-btn--quiet tray-btn--sm tray-btn--icon" type="button" aria-label="Notifications, 2 unread"><svg class="tray-icon" aria-hidden="true"><use href="#tray-i-bell"/></svg></button><span class="tray-pip">2</span></span>
        <button class="tray-avatar" type="button" aria-label="Account: Oksana Franko">OF</button>
      </div>
    </header>
    <main class="tray-app__content">
      <div class="tray-pagehead">
        <div class="tray-pagehead__row">
          <div class="tray-pagehead__text">
            <h1 class="title">Home</h1>
            <p>Orders, revenue and packing over the last 7 days.</p>
          </div>
          <div class="tray-pagehead__actions">
            <button class="tray-btn tray-btn--quiet tray-btn--sm" type="button"><svg class="tray-icon" aria-hidden="true"><use href="#tray-i-download"/></svg>Export</button>
            <button class="tray-btn tray-btn--sm" type="button"><svg class="tray-icon" aria-hidden="true"><use href="#tray-i-plus"/></svg>New order</button>
          </div>
        </div>
      </div>
      <div class="tray-stats tray-stats--four">
        <div class="tray-stat">
          <p class="tray-stat__label">Orders</p>
          <p class="tray-stat__value">243</p>
          <p class="tray-stat__foot"><span class="tray-trend" data-tone="good"><svg class="tray-icon tray-icon--sm" aria-hidden="true"><use href="#tray-i-trending-up"/></svg>+10%</span>than the week before</p>
        </div>
        <div class="tray-stat">
          <p class="tray-stat__label">Revenue</p>
          <p class="tray-stat__value">$23,513</p>
          <p class="tray-stat__foot"><span class="tray-trend" data-tone="good"><svg class="tray-icon tray-icon--sm" aria-hidden="true"><use href="#tray-i-trending-up"/></svg>+11%</span>than the week before</p>
        </div>
        <div class="tray-stat">
          <p class="tray-stat__label">Returns</p>
          <p class="tray-stat__value">3</p>
          <p class="tray-stat__foot"><span class="tray-trend" data-tone="good"><svg class="tray-icon tray-icon--sm" aria-hidden="true"><use href="#tray-i-trending-down"/></svg>&minus;2</span>than the week before</p>
        </div>
        <div class="tray-stat">
          <p class="tray-stat__label">Time to pack</p>
          <p class="tray-stat__value">26<small>min</small></p>
          <p class="tray-stat__foot"><span class="tray-trend" data-tone="bad"><svg class="tray-icon tray-icon--sm" aria-hidden="true"><use href="#tray-i-trending-up"/></svg>+4 min</span>than the week before</p>
        </div>
      </div>
      <section class="tray-card tray-stack tray-stack--lg" aria-labelledby="orders-chart-title">
        <div class="tray-row tray-row--between">
          <div class="tray-stack tray-stack--sm">
            <h2 class="subtitle" id="orders-chart-title">Orders per day</h2>
            <p class="tray-chart__caption" id="orders-range">13 to 26 November</p>
          </div>
          <div class="tray-seg tray-seg--sm" role="radiogroup" aria-label="Period" id="orders-period">
            <label class="tray-seg__item"><input type="radio" name="period" value="7" data-range="20 to 26 November"><span>7 days</span></label>
            <label class="tray-seg__item"><input type="radio" name="period" value="14" data-range="13 to 26 November" checked><span>14 days</span></label>
          </div>
        </div>
        <figure class="tray-chart" id="orders-chart" data-tray="chart" data-chart='{
          "type": "bar", "unit": " orders", "max": 50, "labelHead": "Day of November",
          "labels": ["13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23", "24", "25", "26"],
          "series": [{ "name": "Orders", "values": [34, 27, 22, 32, 38, 33, 35, 37, 30, 24, 35, 43, 36, 38] }],
          "summary": "Bar chart of orders per day from 13 to 26 November. Weekends are the quietest days. The most, 43 orders, came on Tuesday 24 November."
        }'></figure>
      </section>
      <section class="tray-stack" aria-labelledby="orders-table-title">
        <h2 class="subtitle" id="orders-table-title">Latest orders</h2>
        <div class="tray-datatable" id="orders-table" data-tray="datatable" data-page-size="6">
          <div class="tray-datatable__bar">
            <div class="tray-input-group tray-input-group--sm"><span class="tray-input-group__addon"><svg class="tray-icon" aria-hidden="true"><use href="#tray-i-search"/></svg></span><input class="tray-input" type="search" placeholder="Filter orders" aria-label="Filter orders" data-filter></div>
            <button class="tray-btn tray-btn--quiet tray-btn--sm" type="button" data-bulk disabled>Print the labels</button>
          </div>
          <div class="tray-table-wrap">
            <table class="tray-table tray-table--hover tray-table--pad" aria-labelledby="orders-table-title" style="min-inline-size: 40rem">
              <thead>
                <tr>
                  <th class="tray-table__check"><label class="tray-check"><input type="checkbox" data-select-all aria-label="Select all orders"><span class="tray-check__box"><svg viewBox="0 0 20 20" aria-hidden="true"><path class="tray-check__tick" d="M4 10.5l4 4 8-9"/><path class="tray-check__dash" d="M5 10h10"/></svg></span></label></th>
                  <th scope="col"><button class="tray-sort" type="button">Order<svg class="tray-icon tray-icon--sm" aria-hidden="true"><use href="#tray-i-arrow-up-down"/></svg></button></th>
                  <th scope="col"><button class="tray-sort" type="button">Customer<svg class="tray-icon tray-icon--sm" aria-hidden="true"><use href="#tray-i-arrow-up-down"/></svg></button></th>
                  <th scope="col"><button class="tray-sort" type="button">Status<svg class="tray-icon tray-icon--sm" aria-hidden="true"><use href="#tray-i-arrow-up-down"/></svg></button></th>
                  <th scope="col" aria-sort="descending"><button class="tray-sort" type="button">Updated<svg class="tray-icon tray-icon--sm" aria-hidden="true"><use href="#tray-i-arrow-down"/></svg></button></th>
                  <th scope="col" data-num><button class="tray-sort" type="button">Total<svg class="tray-icon tray-icon--sm" aria-hidden="true"><use href="#tray-i-arrow-up-down"/></svg></button></th>
                </tr>
              </thead>
              <tbody>
                <tr>
                  <td class="tray-table__check"><label class="tray-check"><input type="checkbox" data-select aria-label="Select order PL-20431"><span class="tray-check__box"><svg viewBox="0 0 20 20" aria-hidden="true"><path class="tray-check__tick" d="M4 10.5l4 4 8-9"/><path class="tray-check__dash" d="M5 10h10"/></svg></span></label></td>
                  <th scope="row">PL-20431</th>
                  <td>Dana Kovalenko</td>
                  <td><span class="tray-badge">To pack</span></td>
                  <td data-value="202611271031"><time datetime="2026-11-27T10:31">10:31</time></td>
                  <td data-num>$274.00</td>
                </tr>
                <tr>
                  <td class="tray-table__check"><label class="tray-check"><input type="checkbox" data-select aria-label="Select order PL-20362"><span class="tray-check__box"><svg viewBox="0 0 20 20" aria-hidden="true"><path class="tray-check__tick" d="M4 10.5l4 4 8-9"/><path class="tray-check__dash" d="M5 10h10"/></svg></span></label></td>
                  <th scope="row">PL-20362</th>
                  <td>Viktor Marchenko</td>
                  <td><span class="tray-badge tray-badge--success"><svg class="tray-icon tray-icon--sm" aria-hidden="true"><use href="#tray-i-check"/></svg>Delivered</span></td>
                  <td data-value="202611270958"><time datetime="2026-11-27T09:58">09:58</time></td>
                  <td data-num>$118.00</td>
                </tr>
                <tr>
                  <td class="tray-table__check"><label class="tray-check"><input type="checkbox" data-select aria-label="Select order PL-20418"><span class="tray-check__box"><svg viewBox="0 0 20 20" aria-hidden="true"><path class="tray-check__tick" d="M4 10.5l4 4 8-9"/><path class="tray-check__dash" d="M5 10h10"/></svg></span></label></td>
                  <th scope="row">PL-20418</th>
                  <td>Ivan Petrenko</td>
                  <td><span class="tray-badge tray-badge--ink">With the courier</span></td>
                  <td data-value="202611270926"><time datetime="2026-11-27T09:26">09:26</time></td>
                  <td data-num>$186.00</td>
                </tr>
                <tr>
                  <td class="tray-table__check"><label class="tray-check"><input type="checkbox" data-select aria-label="Select order PL-20347"><span class="tray-check__box"><svg viewBox="0 0 20 20" aria-hidden="true"><path class="tray-check__tick" d="M4 10.5l4 4 8-9"/><path class="tray-check__dash" d="M5 10h10"/></svg></span></label></td>
                  <th scope="row">PL-20347</th>
                  <td>Iryna Lysenko</td>
                  <td><span class="tray-badge tray-badge--danger"><svg class="tray-icon tray-icon--sm" aria-hidden="true"><use href="#tray-i-circle-alert"/></svg>Return asked</span></td>
                  <td data-value="202611270902"><time datetime="2026-11-27T09:02">09:02</time></td>
                  <td data-num>$68.00</td>
                </tr>
                <tr>
                  <td class="tray-table__check"><label class="tray-check"><input type="checkbox" data-select aria-label="Select order PL-20430"><span class="tray-check__box"><svg viewBox="0 0 20 20" aria-hidden="true"><path class="tray-check__tick" d="M4 10.5l4 4 8-9"/><path class="tray-check__dash" d="M5 10h10"/></svg></span></label></td>
                  <th scope="row">PL-20430</th>
                  <td>Marta Hrytsenko</td>
                  <td><span class="tray-badge">To pack</span></td>
                  <td data-value="202611270844"><time datetime="2026-11-27T08:44">08:44</time></td>
                  <td data-num>$68.00</td>
                </tr>
                <tr>
                  <td class="tray-table__check"><label class="tray-check"><input type="checkbox" data-select aria-label="Select order PL-20371"><span class="tray-check__box"><svg viewBox="0 0 20 20" aria-hidden="true"><path class="tray-check__tick" d="M4 10.5l4 4 8-9"/><path class="tray-check__dash" d="M5 10h10"/></svg></span></label></td>
                  <th scope="row">PL-20371</th>
                  <td>Olena Bondar</td>
                  <td><span class="tray-badge tray-badge--success"><svg class="tray-icon tray-icon--sm" aria-hidden="true"><use href="#tray-i-check"/></svg>Delivered</span></td>
                  <td data-value="202611270831"><time datetime="2026-11-27T08:31">08:31</time></td>
                  <td data-num>$68.00</td>
                </tr>
                <tr>
                  <td class="tray-table__check"><label class="tray-check"><input type="checkbox" data-select aria-label="Select order PL-20429"><span class="tray-check__box"><svg viewBox="0 0 20 20" aria-hidden="true"><path class="tray-check__tick" d="M4 10.5l4 4 8-9"/><path class="tray-check__dash" d="M5 10h10"/></svg></span></label></td>
                  <th scope="row">PL-20429</th>
                  <td>Bohdan Shevchuk</td>
                  <td><span class="tray-badge">To pack</span></td>
                  <td data-value="202611270802"><time datetime="2026-11-27T08:02">08:02</time></td>
                  <td data-num>$245.00</td>
                </tr>
                <tr>
                  <td class="tray-table__check"><label class="tray-check"><input type="checkbox" data-select aria-label="Select order PL-20415"><span class="tray-check__box"><svg viewBox="0 0 20 20" aria-hidden="true"><path class="tray-check__tick" d="M4 10.5l4 4 8-9"/><path class="tray-check__dash" d="M5 10h10"/></svg></span></label></td>
                  <th scope="row">PL-20415</th>
                  <td>Halyna Rudenko</td>
                  <td><span class="tray-badge tray-badge--ink">With the courier</span></td>
                  <td data-value="202611270748"><time datetime="2026-11-27T07:48">07:48</time></td>
                  <td data-num>$85.00</td>
                </tr>
                <tr>
                  <td class="tray-table__check"><label class="tray-check"><input type="checkbox" data-select aria-label="Select order PL-20428"><span class="tray-check__box"><svg viewBox="0 0 20 20" aria-hidden="true"><path class="tray-check__tick" d="M4 10.5l4 4 8-9"/><path class="tray-check__dash" d="M5 10h10"/></svg></span></label></td>
                  <th scope="row">PL-20428</th>
                  <td>Larysa Koval</td>
                  <td><span class="tray-badge">To pack</span></td>
                  <td data-value="202611270735"><time datetime="2026-11-27T07:35">07:35</time></td>
                  <td data-num>$177.00</td>
                </tr>
                <tr>
                  <td class="tray-table__check"><label class="tray-check"><input type="checkbox" data-select aria-label="Select order PL-20427"><span class="tray-check__box"><svg viewBox="0 0 20 20" aria-hidden="true"><path class="tray-check__tick" d="M4 10.5l4 4 8-9"/><path class="tray-check__dash" d="M5 10h10"/></svg></span></label></td>
                  <th scope="row">PL-20427</th>
                  <td>Petro Kravets</td>
                  <td><span class="tray-badge">To pack</span></td>
                  <td data-value="202611270648"><time datetime="2026-11-27T06:48">06:48</time></td>
                  <td data-num>$47.00</td>
                </tr>
                <tr>
                  <td class="tray-table__check"><label class="tray-check"><input type="checkbox" data-select aria-label="Select order PL-20426"><span class="tray-check__box"><svg viewBox="0 0 20 20" aria-hidden="true"><path class="tray-check__tick" d="M4 10.5l4 4 8-9"/><path class="tray-check__dash" d="M5 10h10"/></svg></span></label></td>
                  <th scope="row">PL-20426</th>
                  <td>Nadia Moroz</td>
                  <td><span class="tray-badge">To pack</span></td>
                  <td data-value="202611262147"><time datetime="2026-11-26T21:47">Thu, 21:47</time></td>
                  <td data-num>$127.00</td>
                </tr>
                <tr>
                  <td class="tray-table__check"><label class="tray-check"><input type="checkbox" data-select aria-label="Select order PL-20425"><span class="tray-check__box"><svg viewBox="0 0 20 20" aria-hidden="true"><path class="tray-check__tick" d="M4 10.5l4 4 8-9"/><path class="tray-check__dash" d="M5 10h10"/></svg></span></label></td>
                  <th scope="row">PL-20425</th>
                  <td>Roman Savchenko</td>
                  <td><span class="tray-badge">To pack</span></td>
                  <td data-value="202611261920"><time datetime="2026-11-26T19:20">Thu, 19:20</time></td>
                  <td data-num>$118.00</td>
                </tr>
                <tr data-empty hidden>
                  <td colspan="6">
                    <div class="tray-empty">
                      <div class="tray-empty__text">
                        <p class="control">No order matches that filter</p>
                        <p>Check the spelling, or clear the filter.</p>
                      </div>
                    </div>
                  </td>
                </tr>
              </tbody>
            </table>
          </div>
          <div class="tray-datatable__foot">
            <span data-selected-count></span>
            <div class="tray-row tray-row--sm">
              <span data-page-status></span>
              <button class="tray-btn tray-btn--quiet tray-btn--xs tray-btn--icon" type="button" data-page-prev aria-label="Previous page"><svg class="tray-icon tray-icon--flip" aria-hidden="true"><use href="#tray-i-chevron-left"/></svg></button>
              <button class="tray-btn tray-btn--quiet tray-btn--xs tray-btn--icon" type="button" data-page-next aria-label="Next page"><svg class="tray-icon tray-icon--flip" aria-hidden="true"><use href="#tray-i-chevron-right"/></svg></button>
            </div>
          </div>
        </div>
      </section>
    </main>
  </div>
</div>
<script src="../components/bundle.js"></script>
<script>
/* The period switch redraws the chart from the last 7 or 14 days; the bulk action wakes when a row is selected. */
(function () {
  var chart = document.getElementById('orders-chart');
  var range = document.getElementById('orders-range');
  var all = JSON.parse(chart.getAttribute('data-chart'));
  var bulk = document.querySelector('[data-bulk]');
  document.getElementById('orders-period').addEventListener('change', function (event) {
    var cut = all.labels.length - Number(event.target.value);
    var values = all.series[0].values.slice(cut);
    range.textContent = event.target.getAttribute('data-range');
    TrayUI.chart(chart, {
      type: all.type, unit: all.unit, max: all.max, labelHead: all.labelHead,
      labels: all.labels.slice(cut),
      series: [{ name: all.series[0].name, values: values }],
      summary: 'Bar chart of orders per day, ' + range.textContent + '. The most in one day was ' + Math.max.apply(null, values) + ' orders.'
    });
  });
  document.getElementById('orders-table').addEventListener('tray:change', function (event) {
    bulk.disabled = !event.detail.selected;
  });
})();
</script>
</body>
</html>
```
