Skip to content

DocsShell

The frame of a documentation site: header, navigation, the article with «On this page», search, and the skeleton of the next page while it loads. This gallery is built on it.

import DocsShell from '@sypnia/ui/astro/DocsShell.astro'

On this page
  1. A whole docs page
  2. Using it
  3. Skeleton
  4. When to use it
  5. For everyone

A whole docs page

Made only of the docs kit. Make the window narrow for the drawer; press Ctrl K to search; use the button left of the logo to fold the navigation away.

Code
---
// A whole docs page: open it in its own tab to try the drawer, the fold button, search (Ctrl K) and «On this page».
---
<iframe src="/demo/docs" title="A docs page made with DocsShell" loading="lazy" style="display:block;width:100%;height:40rem;border:0;background:var(--bg)"></iframe>

Using it

DocsHead goes in the head, the shell in the body, and @sypnia/ui/dom/elements is imported once.

Skip to content
  1. Install
  2. Connect

    Search pages, sections and terms

    Code
    ---
    import DocsHead from '@sypnia/ui/astro/DocsHead.astro';
    import DocsShell from '@sypnia/ui/astro/DocsShell.astro';
    import ArticleHead from '@sypnia/ui/astro/ArticleHead.astro';
    import Prose from '@sypnia/ui/astro/Prose.astro';
    import PrevNext from '@sypnia/ui/astro/PrevNext.astro';
    const nav = [{ title: 'Get started', items: [{ label: 'Quickstart', href: '/docs/quickstart' }, { label: 'Concepts', href: '/docs/concepts' }] }];
    const toc = [{ id: 'install', text: 'Install', depth: 2 }, { id: 'connect', text: 'Connect', depth: 2 }];
    ---
    <html lang="en">
      <head><meta charset="utf-8" /><DocsHead /></head>
      <body>
        <DocsShell nav={nav} toc={toc} product="Docs" search="/search.json"
          languages={[{ code: 'en', label: 'English', href: '/docs/quickstart' }, { code: 'es', label: 'Español', href: '/es/docs/quickstart' }]}>
          <ArticleHead title="Quickstart" lead="From the package to your first table." toc={toc} />
          <Prose><h2 id="install">Install</h2><p>…</p><h2 id="connect">Connect</h2><p>…</p></Prose>
          <PrevNext next={{ title: 'Concepts', href: '/docs/concepts' }} />
        </DocsShell>
        <script>import '@sypnia/ui/dom/elements';</script>
      </body>
    </html>

    Skeleton

    Press any link in the gallery's navigation: this takes the place of the article at once, while the header and the navigation stay. The browser goes on loading the page as usual.

    Code
    ---
    // What DocsShell shows the moment a link is pressed, in place of the article: the header and the navigation stay.
    import DocsArticleSkeleton from '@sypnia/ui/astro/DocsArticleSkeleton.astro';
    ---
    <div class="sy-docs" style="min-height:0;background:none"><DocsArticleSkeleton toc={false} paragraphs={2} /></div>

    When to use it

    Use it when

    • A site whose pages are read in order: documentation, guides, a reference, a gallery.
    • You want search, navigation and «On this page» to work alike on every Sypnia site.

    Do not use it when

    • A signed-in console where people work on data: that is AppShell.
    • A landing page that sells: it has no side navigation.

    For everyone

    • A link skips to the article first; the navigation is a named landmark, the article is the main one.
    • On phones the navigation is a drawer: it takes focus, Escape closes it, and focus goes back to the menu button.
    • Every page works as plain links without JavaScript; the skeleton, the drawer and search are additions.
    • The skeleton is hidden from screen readers; the article is marked busy while it shows.
    1. A whole docs page
    2. Using it
    3. Skeleton
    4. When to use it
    5. For everyone

      Search pages, sections and terms