# Dashboard layout / Estructura de dashboard

> Side navigation and content with metrics and a chart.

Page: https://componentes-lovat.vercel.app/c/dashboard/  
License: MIT · Design: coss ui (MIT) · card.tsx, sidebar.tsx (aspecto)  
Requires: tokens.css, stat-card, chart, button  
Context: herramienta · Density: alta · Tone: sobria

## Files

- Tokens (once): https://componentes-lovat.vercel.app/tokens.css
- Dependency `stat-card`: https://componentes-lovat.vercel.app/r/stat-card.json
- Dependency `chart`: https://componentes-lovat.vercel.app/r/chart.json
- Dependency `button`: https://componentes-lovat.vercel.app/r/button.json
- HTML: https://componentes-lovat.vercel.app/raw/dashboard/dashboard.html
- CSS: https://componentes-lovat.vercel.app/raw/dashboard/dashboard.css
- Everything in one file: https://componentes-lovat.vercel.app/r/dashboard.html

Dark theme: add class `dark` to `<html>`.

## When to use

- For internal tools, panels and admin.
- When people come back daily to check numbers.

## When not to use

- For a landing page: use sections.
- With more than 6 sidebar links: group them.

## Accessibility

Roles: navigation, main

| Keys | Action |
|---|---|
| Tab | Moves through navigation, buttons and chart |

- <aside> with a labelled <nav> and aria-current on the current page.
- On mobile the sidebar moves to the top with horizontal scroll.

## Code

```html
<div class="c-dash">
  <aside class="c-dash__side">
    <a class="c-dash__brand" href="#"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect x="3" y="3" width="7" height="7" rx="2"/><rect x="14" y="3" width="7" height="7" rx="3.5"/><rect x="3" y="14" width="7" height="7" rx="2"/><rect x="14" y="14" width="7" height="7" rx="2"/></svg><span>Estudio</span></a>
    <nav class="c-dash__nav" aria-label="Panel">
      <ul>
        <li><a class="c-dash__link" href="#resumen" aria-current="page"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M3 12 12 3l9 9"/><path d="M5 10v10h14V10"/></svg><span>Resumen</span></a></li>
        <li><a class="c-dash__link" href="#pedidos"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M6 2 3 6v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V6l-3-4z"/><path d="M3 6h18"/><path d="M16 10a4 4 0 0 1-8 0"/></svg><span>Pedidos</span></a></li>
        <li><a class="c-dash__link" href="#clientes"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><circle cx="9" cy="8" r="4"/><path d="M2 21a7 7 0 0 1 14 0"/><path d="M17 11a3 3 0 1 0 0-6"/><path d="M22 21a6 6 0 0 0-4-5.6"/></svg><span>Clientes</span></a></li>
        <li><a class="c-dash__link" href="#informes"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M3 3v18h18"/><path d="M7 15l4-4 3 3 5-6"/></svg><span>Informes</span></a></li>
        <li><a class="c-dash__link" href="#ajustes"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><circle cx="12" cy="12" r="3"/><path d="M19.4 15a1.7 1.7 0 0 0 .3 1.8l.1.1a2 2 0 1 1-2.8 2.8l-.1-.1a1.7 1.7 0 0 0-1.8-.3 1.7 1.7 0 0 0-1 1.5V21a2 2 0 1 1-4 0v-.1a1.7 1.7 0 0 0-1.1-1.5 1.7 1.7 0 0 0-1.8.3l-.1.1a2 2 0 1 1-2.8-2.8l.1-.1a1.7 1.7 0 0 0 .3-1.8 1.7 1.7 0 0 0-1.5-1H3a2 2 0 1 1 0-4h.1a1.7 1.7 0 0 0 1.5-1.1 1.7 1.7 0 0 0-.3-1.8l-.1-.1a2 2 0 1 1 2.8-2.8l.1.1a1.7 1.7 0 0 0 1.8.3H9a1.7 1.7 0 0 0 1-1.5V3a2 2 0 1 1 4 0v.1a1.7 1.7 0 0 0 1 1.5 1.7 1.7 0 0 0 1.8-.3l.1-.1a2 2 0 1 1 2.8 2.8l-.1.1a1.7 1.7 0 0 0-.3 1.8V9a1.7 1.7 0 0 0 1.5 1H21a2 2 0 1 1 0 4h-.1a1.7 1.7 0 0 0-1.5 1z"/></svg><span>Ajustes</span></a></li>
      </ul>
    </nav>
    <p class="c-dash__user"><span class="c-dash__avatar" aria-hidden="true">AL</span><span>Alonso<small>Administrador</small></span></p>
  </aside>
  <main class="c-dash__main">
    <header class="c-dash__head">
      <div><h1 class="c-dash__title">Resumen</h1><p class="c-dash__sub">Septiembre 2026 · datos de ejemplo</p></div>
      <div class="c-btn-row"><button class="c-btn c-btn--outline c-btn--sm" type="button">Exportar</button><button class="c-btn c-btn--primary c-btn--sm" type="button">Nuevo pedido</button></div>
    </header>
    <div class="c-stat-grid c-dash__stats">
      <article class="c-stat"><h2 class="c-stat__label">Ingresos</h2><p class="c-stat__value">S/ 48 200</p><p class="c-stat__delta"><span aria-hidden="true">↑</span> 12 % <span class="c-stat__vs">frente a agosto</span></p><svg class="c-stat__spark" data-values="31,33,30,36,38,37,41,44,43,48" aria-hidden="true" focusable="false"></svg></article>
      <article class="c-stat"><h2 class="c-stat__label">Pedidos</h2><p class="c-stat__value">1 130</p><p class="c-stat__delta"><span aria-hidden="true">↑</span> 7 % <span class="c-stat__vs">frente a agosto</span></p><svg class="c-stat__spark" data-values="88,92,95,90,99,104,101,108,110,113" aria-hidden="true" focusable="false"></svg></article>
      <article class="c-stat"><h2 class="c-stat__label">Ticket medio</h2><p class="c-stat__value">S/ 42,70</p><p class="c-stat__delta"><span aria-hidden="true">↑</span> 4 % <span class="c-stat__vs">frente a agosto</span></p><svg class="c-stat__spark" data-values="39,40,40.5,40,41,41.8,41.2,42,42.4,42.7" aria-hidden="true" focusable="false"></svg></article>
    </div>
    <section class="c-dash__panel">
      <figure class="c-chart" data-c-chart data-type="line">
        <figcaption class="c-chart__head"><span class="c-chart__title">Ingresos por semana (S/ miles)</span><span class="c-chart__note">Datos de ejemplo</span></figcaption>
        <div class="c-chart__legend" aria-hidden="true"></div>
        <div class="c-chart__plot" tabindex="0"></div>
        <p class="c-chart__readout" aria-live="polite"></p>
        <details class="c-chart__data"><summary>Ver datos</summary><table><thead><tr><th scope="col">Semana</th><th scope="col">Septiembre</th><th scope="col">Agosto</th></tr></thead><tbody>
          <tr><th scope="row">S1</th><td>10.2</td><td>9.1</td></tr><tr><th scope="row">S2</th><td>11.8</td><td>9.8</td></tr><tr><th scope="row">S3</th><td>12.1</td><td>10.4</td></tr><tr><th scope="row">S4</th><td>14.1</td><td>11.7</td></tr>
        </tbody></table></details>
      </figure>
    </section>
  </main>
</div>
```

```css
/* Estructura de dashboard: barra lateral + contenido. Pocos componentes y densos; color solo del tema.
   En pantallas angostas, la barra lateral pasa arriba como navegación horizontal. Necesita tokens.css. */
.c-dash { display: grid; grid-template-columns: 15rem minmax(0, 1fr); min-height: 100%; width: 100%; background: var(--background); color: var(--foreground); }
.c-dash__side { display: flex; flex-direction: column; gap: 1.25rem; padding: 1rem .75rem; border-right: 1px solid var(--border); background: var(--muted); }
.c-dash__brand { display: flex; align-items: center; gap: .5rem; padding: .25rem .5rem; color: var(--foreground); text-decoration: none; font-weight: 600; }
.c-dash__brand svg { width: 1.25rem; height: 1.25rem; color: var(--primary); }
.c-dash__nav ul { list-style: none; margin: 0; padding: 0; display: grid; gap: .125rem; }
.c-dash__link { display: flex; align-items: center; gap: .625rem; padding: .5rem; border-radius: var(--radius); color: var(--muted-foreground); text-decoration: none; font-size: .875rem; transition: background-color .15s, color .15s; }
.c-dash__link svg { width: 1rem; height: 1rem; flex: none; }
.c-dash__link:hover { background: var(--accent); color: var(--accent-foreground); }
.c-dash__link:focus-visible { outline: 2px solid var(--ring); outline-offset: -2px; }
.c-dash__link[aria-current=page] { background: var(--background); color: var(--foreground); font-weight: 500; box-shadow: 0 1px 2px 0 #0000000d, 0 0 0 1px var(--border); }
.c-dash__user { margin: auto 0 0; display: flex; align-items: center; gap: .625rem; padding: .5rem; font-size: .875rem; font-weight: 500; }
.c-dash__user small { display: block; font-size: .75rem; font-weight: 400; color: var(--muted-foreground); }
.c-dash__avatar { display: grid; place-items: center; width: 2rem; height: 2rem; border-radius: 50%; background: var(--primary); color: var(--primary-foreground); font-size: .6875rem; font-weight: 600; }
.c-dash__main { display: grid; align-content: start; gap: 1.25rem; padding: 1.5rem; min-width: 0; }
.c-dash__head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: .75rem; }
.c-dash__title { margin: 0; font-size: 1.375rem; font-weight: 600; letter-spacing: -.02em; }
.c-dash__sub { margin: .125rem 0 0; font-size: .8125rem; color: var(--muted-foreground); }
.c-dash__stats { max-width: none; }
.c-dash__panel { padding: 1.125rem 1.25rem; border: 1px solid var(--border); border-radius: calc(var(--radius) + 6px); background: var(--card); color: var(--card-foreground); box-shadow: 0 1px 2px 0 #0000000d; min-width: 0; }
.c-dash__panel .c-chart { max-width: none; }
@media (width < 48rem) {
  .c-dash { grid-template-columns: 1fr; }
  .c-dash__side { flex-direction: row; align-items: center; gap: .5rem; padding: .5rem .75rem; border-right: 0; border-bottom: 1px solid var(--border); overflow-x: auto; }
  .c-dash__nav ul { display: flex; }
  .c-dash__link span { white-space: nowrap; }
  .c-dash__brand span, .c-dash__user { display: none; }
  .c-dash__main { padding: 1rem; }
}
```

## Credits

- coss ui (MIT) · card.tsx, sidebar.tsx (aspecto): https://coss.com/ui
