Skip to content

Sidebar with a file tree

A sidebar with a collapsible file tree.

Preview

Open the screen alone (new tab)

Built with

The components this screen renders, through their own templates. Changing one of them, or a token they read, changes this screen.

Design system gaps

What the design system lacks to render the original as it is. The screen fills each gap with native HTML on semantic tokens until a component or a token covers it.

  • Collapsing the sidebar (off canvas or to an icon rail) has no pattern without script yet.
  • The sidebar navigation (groups, items, sub-items, current item) is native HTML on semantic tokens: there is no Navigation component yet.
  • Folders of the file tree are native details elements on semantic tokens: there is no Disclosure or Tree view component yet.

Changes from the original

  • The sidebar does not collapse (that needs script, and so does the trigger button): it is always expanded on wide screens and stacks above the content on narrow ones. The sidebar trigger and its separator are dropped.
  • The rail that resizes the sidebar is dropped.
  • Files and changed files are links (the original has buttons with no action); the open file, button.tsx, is marked as the current page, as the breadcrumb says.
  • The folder chevron follows the folder name, as in every other sidebar of the system (the original puts it first).
  • Rebuilt as static HTML with the design system's component templates; every color, type style, radius, border and spacing comes from its tokens.
  • The original visual design (Tailwind classes, the Geist font) is not reused.
  • Lucide and Tabler icons are remapped to Material Symbols; brand logos (Apple, Google, GitHub, Meta) are dropped, the buttons keep their text.
  • Placeholder images are drawn with semantic tokens.
  • No script: behaviour that needs JavaScript (collapsing the sidebar, toasts, drag and drop, client-side tables) is dropped or simplified, and each screen says so.

Code

The HTML the screen renders, from apps/docs/screens/shadcn-ui/sidebar-11.screen.mjs, with the stylesheets of @quantum-ds/tokens, the reference implementation (packages/components/src/) and apps/docs/screens/screens.css.

HTML
<div class="scr-viewport">
  <div class="scr-screen">
    <div class="scr-shell" data-variant="sidebar" data-side="left">
      <nav class="scr-sidebar" aria-label="Files">
        <div class="scr-sidebar__content">
          <div
            class="scr-nav-group"
            role="group"
            aria-labelledby="sidebar-11-changes-label"
          >
            <p
              class="scr-nav-group__label"
              id="sidebar-11-changes-label"
            >Changes</p>
            <ul class="scr-nav">
              <li class="scr-nav__item">
                <a class="scr-nav__link" href="#">
                  <span
                    class="ds-icon"
                    data-size="small"
                    data-color="current"
                    aria-hidden="true"
                  >description</span>
                  <span class="scr-nav__label">README.md</span>
                  <span class="scr-nav__meta">M</span>
                </a>
              </li>
              <li class="scr-nav__item">
                <a class="scr-nav__link" href="#">
                  <span
                    class="ds-icon"
                    data-size="small"
                    data-color="current"
                    aria-hidden="true"
                  >description</span>
                  <span class="scr-nav__label">api/hello/route.ts</span>
                  <span class="scr-nav__meta">U</span>
                </a>
              </li>
              <li class="scr-nav__item">
                <a class="scr-nav__link" href="#">
                  <span
                    class="ds-icon"
                    data-size="small"
                    data-color="current"
                    aria-hidden="true"
                  >description</span>
                  <span class="scr-nav__label">app/layout.tsx</span>
                  <span class="scr-nav__meta">M</span>
                </a>
              </li>
            </ul>
          </div>
          <div
            class="scr-nav-group"
            role="group"
            aria-labelledby="sidebar-11-files-label"
          >
            <p
              class="scr-nav-group__label"
              id="sidebar-11-files-label"
            >Files</p>
            <ul class="scr-nav">
              <li class="scr-nav__item">
                <details>
                  <summary class="scr-nav__summary">
                    <span
                      class="ds-icon"
                      data-size="small"
                      data-color="current"
                      aria-hidden="true"
                    >folder</span>
                    <span class="scr-nav__label">app</span>
                    <span class="scr-nav__chevron">
                      <span
                        class="ds-icon"
                        data-size="small"
                        data-color="current"
                        aria-hidden="true"
                      >chevron_right</span>
                    </span>
                  </summary>
                  <ul class="scr-nav scr-nav--sub">
                    <li class="scr-nav__item">
                      <details>
                        <summary class="scr-nav__summary">
                          <span
                            class="ds-icon"
                            data-size="small"
                            data-color="current"
                            aria-hidden="true"
                          >folder</span>
                          <span class="scr-nav__label">api</span>
                          <span class="scr-nav__chevron">
                            <span
                              class="ds-icon"
                              data-size="small"
                              data-color="current"
                              aria-hidden="true"
                            >chevron_right</span>
                          </span>
                        </summary>
                        <ul class="scr-nav scr-nav--sub">
                          <li class="scr-nav__item">
                            <details>
                              <summary class="scr-nav__summary">
                                <span
                                  class="ds-icon"
                                  data-size="small"
                                  data-color="current"
                                  aria-hidden="true"
                                >folder</span>
                                <span class="scr-nav__label">hello</span>
                                <span class="scr-nav__chevron">
                                  <span
                                    class="ds-icon"
                                    data-size="small"
                                    data-color="current"
                                    aria-hidden="true"
                                  >chevron_right</span>
                                </span>
                              </summary>
                              <ul class="scr-nav scr-nav--sub">
                                <li class="scr-nav__item">
                                  <a class="scr-nav__link" href="#">
                                    <span
                                      class="ds-icon"
                                      data-size="small"
                                      data-color="current"
                                      aria-hidden="true"
                                    >description</span>
                                    <span class="scr-nav__label">route.ts</span>
                                  </a>
                                </li>
                              </ul>
                            </details>
                          </li>
                          <li class="scr-nav__item">
                            <a class="scr-nav__link" href="#">
                              <span
                                class="ds-icon"
                                data-size="small"
                                data-color="current"
                                aria-hidden="true"
                              >description</span>
                              <span class="scr-nav__label">page.tsx</span>
                            </a>
                          </li>
                          <li class="scr-nav__item">
                            <a class="scr-nav__link" href="#">
                              <span
                                class="ds-icon"
                                data-size="small"
                                data-color="current"
                                aria-hidden="true"
                              >description</span>
                              <span class="scr-nav__label">layout.tsx</span>
                            </a>
                          </li>
                          <li class="scr-nav__item">
                            <details>
                              <summary class="scr-nav__summary">
                                <span
                                  class="ds-icon"
                                  data-size="small"
                                  data-color="current"
                                  aria-hidden="true"
                                >folder</span>
                                <span class="scr-nav__label">blog</span>
                                <span class="scr-nav__chevron">
                                  <span
                                    class="ds-icon"
                                    data-size="small"
                                    data-color="current"
                                    aria-hidden="true"
                                  >chevron_right</span>
                                </span>
                              </summary>
                              <ul class="scr-nav scr-nav--sub">
                                <li class="scr-nav__item">
                                  <a class="scr-nav__link" href="#">
                                    <span
                                      class="ds-icon"
                                      data-size="small"
                                      data-color="current"
                                      aria-hidden="true"
                                    >description</span>
                                    <span class="scr-nav__label">page.tsx</span>
                                  </a>
                                </li>
                              </ul>
                            </details>
                          </li>
                        </ul>
                      </details>
                    </li>
                  </ul>
                </details>
              </li>
              <li class="scr-nav__item">
                <details open>
                  <summary class="scr-nav__summary">
                    <span
                      class="ds-icon"
                      data-size="small"
                      data-color="current"
                      aria-hidden="true"
                    >folder</span>
                    <span class="scr-nav__label">components</span>
                    <span class="scr-nav__chevron">
                      <span
                        class="ds-icon"
                        data-size="small"
                        data-color="current"
                        aria-hidden="true"
                      >chevron_right</span>
                    </span>
                  </summary>
                  <ul class="scr-nav scr-nav--sub">
                    <li class="scr-nav__item">
                      <details open>
                        <summary class="scr-nav__summary">
                          <span
                            class="ds-icon"
                            data-size="small"
                            data-color="current"
                            aria-hidden="true"
                          >folder</span>
                          <span class="scr-nav__label">ui</span>
                          <span class="scr-nav__chevron">
                            <span
                              class="ds-icon"
                              data-size="small"
                              data-color="current"
                              aria-hidden="true"
                            >chevron_right</span>
                          </span>
                        </summary>
                        <ul class="scr-nav scr-nav--sub">
                          <li class="scr-nav__item">
                            <a
                              class="scr-nav__link"
                              href="#"
                              aria-current="page"
                            >
                              <span
                                class="ds-icon"
                                data-size="small"
                                data-color="current"
                                aria-hidden="true"
                              >description</span>
                              <span class="scr-nav__label">button.tsx</span>
                            </a>
                          </li>
                          <li class="scr-nav__item">
                            <a class="scr-nav__link" href="#">
                              <span
                                class="ds-icon"
                                data-size="small"
                                data-color="current"
                                aria-hidden="true"
                              >description</span>
                              <span class="scr-nav__label">card.tsx</span>
                            </a>
                          </li>
                        </ul>
                      </details>
                    </li>
                    <li class="scr-nav__item">
                      <a class="scr-nav__link" href="#">
                        <span
                          class="ds-icon"
                          data-size="small"
                          data-color="current"
                          aria-hidden="true"
                        >description</span>
                        <span class="scr-nav__label">header.tsx</span>
                      </a>
                    </li>
                    <li class="scr-nav__item">
                      <a class="scr-nav__link" href="#">
                        <span
                          class="ds-icon"
                          data-size="small"
                          data-color="current"
                          aria-hidden="true"
                        >description</span>
                        <span class="scr-nav__label">footer.tsx</span>
                      </a>
                    </li>
                  </ul>
                </details>
              </li>
              <li class="scr-nav__item">
                <details>
                  <summary class="scr-nav__summary">
                    <span
                      class="ds-icon"
                      data-size="small"
                      data-color="current"
                      aria-hidden="true"
                    >folder</span>
                    <span class="scr-nav__label">lib</span>
                    <span class="scr-nav__chevron">
                      <span
                        class="ds-icon"
                        data-size="small"
                        data-color="current"
                        aria-hidden="true"
                      >chevron_right</span>
                    </span>
                  </summary>
                  <ul class="scr-nav scr-nav--sub">
                    <li class="scr-nav__item">
                      <a class="scr-nav__link" href="#">
                        <span
                          class="ds-icon"
                          data-size="small"
                          data-color="current"
                          aria-hidden="true"
                        >description</span>
                        <span class="scr-nav__label">util.ts</span>
                      </a>
                    </li>
                  </ul>
                </details>
              </li>
              <li class="scr-nav__item">
                <details>
                  <summary class="scr-nav__summary">
                    <span
                      class="ds-icon"
                      data-size="small"
                      data-color="current"
                      aria-hidden="true"
                    >folder</span>
                    <span class="scr-nav__label">public</span>
                    <span class="scr-nav__chevron">
                      <span
                        class="ds-icon"
                        data-size="small"
                        data-color="current"
                        aria-hidden="true"
                      >chevron_right</span>
                    </span>
                  </summary>
                  <ul class="scr-nav scr-nav--sub">
                    <li class="scr-nav__item">
                      <a class="scr-nav__link" href="#">
                        <span
                          class="ds-icon"
                          data-size="small"
                          data-color="current"
                          aria-hidden="true"
                        >description</span>
                        <span class="scr-nav__label">favicon.ico</span>
                      </a>
                    </li>
                    <li class="scr-nav__item">
                      <a class="scr-nav__link" href="#">
                        <span
                          class="ds-icon"
                          data-size="small"
                          data-color="current"
                          aria-hidden="true"
                        >description</span>
                        <span class="scr-nav__label">vercel.svg</span>
                      </a>
                    </li>
                  </ul>
                </details>
              </li>
              <li class="scr-nav__item">
                <a class="scr-nav__link" href="#">
                  <span
                    class="ds-icon"
                    data-size="small"
                    data-color="current"
                    aria-hidden="true"
                  >description</span>
                  <span class="scr-nav__label">.eslintrc.json</span>
                </a>
              </li>
              <li class="scr-nav__item">
                <a class="scr-nav__link" href="#">
                  <span
                    class="ds-icon"
                    data-size="small"
                    data-color="current"
                    aria-hidden="true"
                  >description</span>
                  <span class="scr-nav__label">.gitignore</span>
                </a>
              </li>
              <li class="scr-nav__item">
                <a class="scr-nav__link" href="#">
                  <span
                    class="ds-icon"
                    data-size="small"
                    data-color="current"
                    aria-hidden="true"
                  >description</span>
                  <span class="scr-nav__label">next.config.js</span>
                </a>
              </li>
              <li class="scr-nav__item">
                <a class="scr-nav__link" href="#">
                  <span
                    class="ds-icon"
                    data-size="small"
                    data-color="current"
                    aria-hidden="true"
                  >description</span>
                  <span class="scr-nav__label">tailwind.config.js</span>
                </a>
              </li>
              <li class="scr-nav__item">
                <a class="scr-nav__link" href="#">
                  <span
                    class="ds-icon"
                    data-size="small"
                    data-color="current"
                    aria-hidden="true"
                  >description</span>
                  <span class="scr-nav__label">package.json</span>
                </a>
              </li>
              <li class="scr-nav__item">
                <a class="scr-nav__link" href="#">
                  <span
                    class="ds-icon"
                    data-size="small"
                    data-color="current"
                    aria-hidden="true"
                  >description</span>
                  <span class="scr-nav__label">README.md</span>
                </a>
              </li>
            </ul>
          </div>
        </div>
      </nav>
      <div class="scr-main">
        <header class="scr-header">
          <nav
            class="ds-breadcrumb"
            aria-label="Breadcrumb"
            data-size="small"
          >
            <ol class="ds-breadcrumb__list" data-part="list">
              <li class="ds-breadcrumb__item" data-part="item">
                <a
                  class="ds-breadcrumb__link"
                  data-part="link"
                  href="#"
                >components</a>
                <span
                  class="ds-breadcrumb__separator"
                  data-part="separator"
                  aria-hidden="true"
                >chevron_right</span>
              </li>
              <li class="ds-breadcrumb__item" data-part="item">
                <a
                  class="ds-breadcrumb__link"
                  data-part="link"
                  href="#"
                >ui</a>
                <span
                  class="ds-breadcrumb__separator"
                  data-part="separator"
                  aria-hidden="true"
                >chevron_right</span>
              </li>
              <li class="ds-breadcrumb__item" data-part="item">
                <span
                  class="ds-breadcrumb__link"
                  data-part="link"
                  aria-current="page"
                >button.tsx</span>
              </li>
            </ol>
          </nav>
        </header>
        <main class="scr-content">
          <h1 class="scr-sr">button.tsx</h1>
          <div class="scr-stack" aria-hidden="true">
            <div class="scr-tiles">
              <div class="scr-tile"></div>
              <div class="scr-tile"></div>
              <div class="scr-tile"></div>
            </div>
            <div class="scr-tile" data-size="large"></div>
          </div>
        </main>
      </div>
    </div>
  </div>
</div>