Skip to content
npm ↗ GitHub ↗

Documentation

08/Structure

Dashboard layout

Fixed sidebar, topbar and content area. On mobile the sidebar becomes a side panel.

Structure

See the full template in examples/dashboard.html.

Resumen
Q 48kVentas del mes
312Pedidos
HTML
<div class="cb-dash">
  <aside class="cb-dash__sidebar" id="sidebar" data-cb-dash-sidebar aria-label="Menú del panel">
    <a href="#" class="cb-logo cb-dash__brand">...</a>
    <nav class="cb-dash__nav">
      <div class="cb-dash__group">
        <p class="cb-dash__group-title">General</p>
        <a class="cb-dash__link" href="#" aria-current="page">Resumen</a>
      </div>
    </nav>
  </aside>
  <div class="cb-dash__scrim" data-cb-dash-scrim="sidebar"></div>
  <div class="cb-dash__main">
    <header class="cb-dash__topbar">
      <button class="cb-icon-btn cb-dash__toggle" type="button" data-cb-dash-toggle="sidebar" aria-label="Menú">...</button>
      <div class="cb-dash__topbar-actions">...</div>
    </header>
    <main class="cb-dash__content">...</main>
  </div>
</div>

Classes and modifiers

ClassDescription
.cb-dashSidebar + content grid. The width is changed with --cb-dash-sidebar.
.cb-dash__sidebarFixed column. Below 960px it is an off-screen panel.
.cb-dash__scrimDark backdrop behind the sidebar on mobile.
.cb-dash__linkLink with an icon; aria-current="page" marks the accent line.
.cb-dash__topbarFixed top bar of the content.
.cb-dash__toggleButton visible only on mobile.
.cb-dash__content, .cb-dash__header, .cb-dash__titleMain area and its header.
.cb-panel, .cb-panel__head, .cb-panel__bodyBordered box to group content.

data-cb-* attributes

AttributeDescription
data-cb-dash-sidebarMarks the sidebar. Needs an id.
data-cb-dash-toggle="id"Button that opens it on mobile.
data-cb-dash-scrim="id"Backdrop that closes it on click.

JavaScript

EventWhen it fires
cb:open / cb:closeOn the sidebar when it opens or closes on mobile.

Accessibility

  • On mobile the sidebar traps focus and closes with Esc.
  • Use main for the content and aria-label on the sidebar.