Navigation

v2.1.0
Site pages

Results

A search, the conditions beside it and the results in cards or a list, with pages.

A results page answers a search: a field for the words, conditions that narrow what was found, a count, a sort, and the results in pages. It stands on the page frame, a header, the main region and a footer, and the document scrolls as a whole. The conditions stand beside the results where there is room and wait in a drawer where there is not.

Results

<div class="page bg-surface-base fg-text-body text-sm" data-example="results">  <a class="skip" href="#rs-main">Skip to content</a>  <header class="navbar" style="--navbar-padding-x: max(1.5rem, calc(50% - 33.5rem))">    <a class="navbar-brand" href="#">      <svg class="icon" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">        <circle cx="8" cy="8" r="6" />        <path d="M8 4.3333A3.6667 3.6667 0 0 1 8 11.6667Z" fill="currentColor" stroke="none" />      </svg>Atlas</a>    <nav class="navbar-nav" aria-label="Main">      <a class="navbar-link" href="#">Product</a>      <a class="navbar-link" href="#">Pricing</a>      <a class="navbar-link" href="#">Docs</a>      <a class="navbar-link" href="#" aria-current="page">Resources</a>    </nav>    <div class="navbar-end">      <a class="btn btn-sm hidden inline-flex@container(--xl)" href="#">Sign in</a>      <button type="button" class="btn btn-quiet btn-square btn-sm navbar-toggle" popovertarget="rs-menu" aria-label="Open the menu">        <svg class="icon" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">          <path d="M3 5.5L13 5.5" />          <path d="M3 10.5L13 10.5" />        </svg>      </button>      <div class="menu menu-end" id="rs-menu" popover>        <a class="menu-item" href="#">Product</a>        <a class="menu-item" href="#">Pricing</a>        <a class="menu-item" href="#">Docs</a>        <a class="menu-item" href="#" aria-current="page">Resources</a>        <a class="menu-item" href="#">Sign in</a>      </div>    </div>  </header>  <main class="grow(1) w-full max-w(1120) mx-auto px-lg py-xl container-inline" id="rs-main" tabindex="-1">    <header class="flex flex-col gap-3xs">      <h1 class="heading heading-xl">Resources</h1>      <p class="m(0) fg-text-muted">Guides, templates, videos and case studies for teams that deploy with Atlas.</p>    </header>    <form class="flex flex-wrap gap-xs max-w(560) mt-lg" id="rs-form" method="get" role="search" aria-label="Resources">      <label class="input-group grow(1) basis(200) min-w(0)">        <svg class="icon" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">          <circle cx="7" cy="7" r="4.5" />          <path d="M10.182 10.182L14 14" />        </svg>        <input class="input-group-field" type="search" name="q" placeholder="Search resources" aria-label="Search resources" autocomplete="off">      </label>      <button class="btn">Search</button>    </form>    <div class="flex flex-col gap-lg mt-xl flex-row@container(--4xl) gap-xl@container(--4xl)">      <div class="w(240)@container(--4xl) pt(6)@container(--4xl) shrink(0)" data-results="sidebar">        <fieldset class="fieldset" data-results="conditions">          <legend class="fieldset-legend">Type</legend>          <label class="check flex">            <input type="checkbox" class="checkbox" name="type" value="guide" form="rs-form">            <span class="grow(1)">Guides</span>            <span class="fg-text-muted" data-count="guide">4</span>          </label>          <label class="check flex">            <input type="checkbox" class="checkbox" name="type" value="template" form="rs-form">            <span class="grow(1)">Templates</span>            <span class="fg-text-muted" data-count="template">3</span>          </label>          <label class="check flex">            <input type="checkbox" class="checkbox" name="type" value="video" form="rs-form">            <span class="grow(1)">Videos</span>            <span class="fg-text-muted" data-count="video">3</span>          </label>          <label class="check flex">            <input type="checkbox" class="checkbox" name="type" value="case-study" form="rs-form">            <span class="grow(1)">Case studies</span>            <span class="fg-text-muted" data-count="case-study">2</span>          </label>        </fieldset>      </div>      <section class="grow(1) basis(0) min-w(0) flex flex-col gap-md" aria-labelledby="rs-results-title">        <h2 class="sr-only" id="rs-results-title">Results</h2>        <div class="flex flex-wrap items-center gap-xs">          <div class="hidden@container(--4xl)" data-results="open" hidden>            <button type="button" class="btn btn-sm" commandfor="rs-filters" command="show-modal">              <svg class="icon" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">                <path d="M4.5365 3L11.4635 3A1 1 0 0 1 12.2548 4.6114L9.4587 8.2299A1 1 0 0 0 9.25 8.8413L9.25 11.323A1 1 0 0 1 8.6214 12.2514L7.875 12.55A0.8203 0.8203 0 0 1 6.75 11.7883L6.75 8.8413A1 1 0 0 0 6.5413 8.2299L3.7452 4.6114A1 1 0 0 1 4.5365 3Z" />              </svg>Filters              <span data-results="applied" hidden>                <span class="badge badge-sm badge-ink badge-pill" aria-hidden="true">0</span>                <span class="sr-only">, 0 applied</span>              </span>            </button>          </div>          <p class="m(0) grow(1) fg-text-muted" id="rs-count" role="status">12 resources</p>          <div data-results="clear" hidden>            <button type="button" class="btn btn-quiet btn-sm">Clear all</button>          </div>          <div class="flex flex-wrap items-center justify-between gap-xs grow(1) grow(0)@container(--md)">            <label class="flex flex-wrap items-center gap-xs fg-text-muted">Sort              <select class="select select-sm" name="sort" form="rs-form">                <option class="select-option" value="updated">Recently updated</option>                <option class="select-option" value="name">Name</option>              </select>            </label>            <div class="segmented segmented-sm" role="radiogroup" aria-label="Show results as">              <label class="segmented-item">                <input type="radio" class="segmented-input" name="view" value="cards" form="rs-form" checked>Cards</label>              <label class="segmented-item">                <input type="radio" class="segmented-input" name="view" value="list" form="rs-form">List</label>            </div>          </div>        </div>        <div id="rs-results">          <ul class="auto-grid" style="--auto-grid-min: 15rem">            <li class="card">              <header class="card-header">                <h3 class="card-title">                  <a class="card-link" href="#">Deploy your first project</a>                </h3>                <p class="card-description">Connect a repository, push to main and open the address Atlas gives it.</p>              </header>              <div class="card-body flex flex-wrap items-center justify-between gap-xs mt-auto fg-text-muted">                <span class="badge">Guide</span>                <time datetime="2026-11-12">Nov 12, 2026</time>              </div>            </li>            <li class="card">              <header class="card-header">                <h3 class="card-title">                  <a class="card-link" href="#">A tour of the new dashboard</a>                </h3>                <p class="card-description">Four minutes through projects, domains and usage, now on one page.</p>              </header>              <div class="card-body flex flex-wrap items-center justify-between gap-xs mt-auto fg-text-muted">                <span class="badge">Video</span>                <time datetime="2026-11-10">Nov 10, 2026</time>              </div>            </li>            <li class="card">              <header class="card-header">                <h3 class="card-title">                  <a class="card-link" href="#">How Borealis cut cold builds to under a minute</a>                </h3>                <p class="card-description">Restoring caches before the install step, measured across forty projects.</p>              </header>              <div class="card-body flex flex-wrap items-center justify-between gap-xs mt-auto fg-text-muted">                <span class="badge">Case study</span>                <time datetime="2026-11-06">Nov 6, 2026</time>              </div>            </li>            <li class="card">              <header class="card-header">                <h3 class="card-title">                  <a class="card-link" href="#">Astro blog starter</a>                </h3>                <p class="card-description">Posts in Markdown, a feed and a preview deployment for every draft.</p>              </header>              <div class="card-body flex flex-wrap items-center justify-between gap-xs mt-auto fg-text-muted">                <span class="badge">Template</span>                <time datetime="2026-11-03">Nov 3, 2026</time>              </div>            </li>            <li class="card">              <header class="card-header">                <h3 class="card-title">                  <a class="card-link" href="#">Roll back without a meeting</a>                </h3>                <p class="card-description">A deployment never changes, so going back is choosing an earlier one.</p>              </header>              <div class="card-body flex flex-wrap items-center justify-between gap-xs mt-auto fg-text-muted">                <span class="badge">Guide</span>                <time datetime="2026-10-29">Oct 29, 2026</time>              </div>            </li>            <li class="card">              <header class="card-header">                <h3 class="card-title">                  <a class="card-link" href="#">Reading a build log</a>                </h3>                <p class="card-description">Where a failed build says what went wrong, and what the timings mean.</p>              </header>              <div class="card-body flex flex-wrap items-center justify-between gap-xs mt-auto fg-text-muted">                <span class="badge">Video</span>                <time datetime="2026-10-24">Oct 24, 2026</time>              </div>            </li>          </ul>        </div>        <div data-results="foot">          <div class="flex flex-wrap items-center justify-between gap-sm">            <p class="m(0) fg-text-muted" id="rs-range">1–6 of 12</p>            <nav aria-label="Pagination">              <ol class="pagination" id="rs-pages">                <li>                  <a class="btn btn-quiet btn-square btn-sm" aria-label="Previous page" aria-disabled="true">                    <svg class="icon" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">                      <path d="M6 3.5L10.3586 7.8586A0.2 0.2 0 0 1 10.3586 8.1414L6 12.5" transform="rotate(180 8 8)" />                    </svg>                  </a>                </li>                <li>                  <a class="btn btn-quiet btn-square btn-sm" href="?page=1" aria-label="Page 1" aria-current="page">1</a>                </li>                <li>                  <a class="btn btn-quiet btn-square btn-sm" href="?page=2" aria-label="Page 2">2</a>                </li>                <li>                  <a class="btn btn-quiet btn-square btn-sm" href="?page=2" aria-label="Next page">                    <svg class="icon" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">                      <path d="M6 3.5L10.3586 7.8586A0.2 0.2 0 0 1 10.3586 8.1414L6 12.5" />                    </svg>                  </a>                </li>              </ol>            </nav>          </div>        </div>        <p class="sr-only" id="rs-status" role="status"></p>      </section>    </div>    <dialog class="dialog dialog-drawer" id="rs-filters" closedby="any" aria-labelledby="rs-filters-title" style="--dialog-width: 20rem">      <header class="dialog-header">        <h2 class="dialog-title" id="rs-filters-title">Filters</h2>      </header>      <div class="dialog-body" data-results="drawer"></div>      <footer class="dialog-footer">        <button type="button" class="btn" data-results="drawer-clear">Clear</button>        <button type="button" class="btn btn-primary" commandfor="rs-filters" command="close" data-results="drawer-done" aria-live="polite">Show 12 results</button>      </footer>      <button type="button" class="btn btn-quiet btn-square btn-sm dialog-close" commandfor="rs-filters" command="close" aria-label="Close the filters">        <svg class="icon" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">          <path d="M4 4L12 12" />          <path d="M4 12L12 4" />        </svg>      </button>    </dialog>  </main>  <footer class="bt(1) bt-solid b-line-hair">    <div class="flex flex-wrap items-center justify-between gap-sm w-full max-w(1120) mx-auto px-lg py-lg text-xs fg-text-muted">      <span>© 2026 Atlas Labs</span>      <nav class="flex flex-wrap gap-lg" aria-label="Footer">        <a class="link link-quiet" href="#">Privacy</a>        <a class="link link-quiet" href="#">Terms</a>        <a class="link link-quiet" href="#">Status</a>      </nav>    </div>  </footer>  <template id="rs-cards">    <ul class="auto-grid" style="--auto-grid-min: 15rem">      <li class="card">        <header class="card-header">          <h3 class="card-title">            <a class="card-link" href="#"></a>          </h3>          <p class="card-description"></p>        </header>        <div class="card-body flex flex-wrap items-center justify-between gap-xs mt-auto fg-text-muted">          <span class="badge"></span>          <time></time>        </div>      </li>    </ul>  </template>  <template id="rs-list">    <ul class="list list-interactive mx(-10)">      <li>        <a class="list-row" href="#">          <div class="list-body">            <h3 class="list-title"></h3>            <p class="list-description"></p>          </div>          <span class="list-end flex items-center gap-sm fg-text-muted">            <time class="hidden inline@container(--md)"></time>            <span class="badge"></span>          </span>        </a>      </li>    </ul>  </template>  <template id="rs-empty">    <div class="empty">      <span class="icon-frame empty-media" aria-hidden="true">        <svg class="icon" viewBox="0 0 20 20" fill="none" stroke="currentColor" stroke-width="1.25" stroke-linecap="round" stroke-linejoin="round">          <circle cx="8.75" cy="8.75" r="5.75" />          <path d="M12.8159 12.8159L17.5 17.5" />        </svg>      </span>      <h3 class="empty-title">No resources match</h3>      <p class="empty-description">Try another word or fewer types, or clear the conditions to see all 12 resources.</p>      <div class="empty-actions">        <button type="button" class="btn btn-sm" data-results="reset">Clear conditions</button>      </div>    </div>  </template>  <template id="rs-page">    <ol class="pagination">      <li>        <a class="btn btn-quiet btn-square btn-sm" aria-label="Page"></a>      </li>    </ol>  </template></div>
Search for “build”, then clear it. Sort by name, go to the second page and switch to List: the sort and the page stay. Choose Tablet or Phone, open Filters and tick a type; choose Desktop, and it is ticked in the sidebar. Search for something that is not there to see the empty state.

The twelve resources are rows in the example's own file, and its script answers from them. A real page asks its server; wiring it to a server says where.

#How it is built

  • page on the frame, one measure inside it. The main region is grow(1) max-w(1120) mx-auto px-lg, and what the footer holds has the same measure. The navbar runs the full width, and its --navbar-padding-x is max(1.5rem, calc(50% - 33.5rem)): the content's own start, so the brand, the title, the search field and the footer's first word stand on one line at every width.
  • The search is a form of its own. <form method="get" role="search"> holds the field, named q, and a submit button. The field is an input-group that grows to the form's max-w(560); where the field would be narrower than 200px the button goes below it.
  • The other fields name the form. The type checkboxes, the sort and the Cards / List switch stand outside the <form> and carry form="rs-form". They are submitted with it wherever they stand, which is what lets the checkboxes move into a drawer.
  • Two columns from 56rem. The main region is a size container, container-inline. The body is flex flex-col, and from 56rem of main region flex-row@container(--4xl): a w(240) column for the conditions, 15rem, and a fluid one for the results, grow(1) basis(0) min-w(0).
  • A count, a sort and a view on one line. The count is a paragraph with role="status" that takes the room left, so the sort and the switch stand at the end. The line wraps: on a phone the sort and the switch take a second row, one at each end.
  • The results are a list either way. As cards, a <ul class="auto-grid"> of cards with --auto-grid-min: 15rem: three across at Desktop, two at Tablet, one at Phone, counted by the grid. As a list, a <ul class="list list-interactive"> whose rows are links; mx(-10) sets the rows' words on the column's edge. Six to a page, with the range and a pagination of links under them.
  • Nothing found is an empty state. It says so, says what to try, and its button clears the search and the types.

#Where the conditions go

There is one set of checkboxes. It is written in the sidebar, and it is moved, not copied.

  • From 56rem of main region the conditions are the 15rem column beside the results, and the Filters button is hidden@container(--4xl).
  • Below 56rem the column is empty and hidden, the Filters button shows, and it opens a drawer, dialog dialog-drawer at --dialog-width: 20rem, with command="show-modal" and commandfor. The script puts the <fieldset> in the drawer's body. A badge on the button counts the types that are ticked.
  • The stylesheet owns the threshold. The script holds no number: when the main region changes size it asks whether the Filters button is displayed and puts the fieldset where that says, in the sidebar or the drawer. Change --4xl in the markup and the script follows.
  • Nothing can be lost between widths, because nothing is duplicated: the checkbox ticked in the drawer is the checkbox in the sidebar. There is no second id and no state to copy. If the page grows wide while the drawer is open, the drawer closes and focus stays on the checkbox it was on.
  • In the drawer a choice applies at once. The results change behind it, the confirming button says how many there are, "Show 4 results", and closes it. Clear unticks the types and leaves the search alone.

Without the script the fieldset stays where it is written, above the results below 56rem and beside them from there, and the Filters button, which would open an empty drawer, stays hidden.

#Wiring it to a server

The markup is what a server would send for the first page: six results, the count, and pagination links. Everything a reader can set is a named field of one GET form, so the URL is the state.

  • The query. Submitting sends ?q=build&type=guide&type=video&sort=name&view=list. type repeats, once for each ticked box; sort is updated or name; view is cards or list. The form has no action, so it submits to the page's own address.
  • The pages. Each pagination link is the same query with page added, ?sort=name&view=list&page=2. The link of the current page has aria-current="page"; "Previous" on the first page and "Next" on the last have no href and aria-disabled="true".
  • What the server renders. The fields with the values it read (value on the search, checked on the boxes and the view, selected on the sort), the results of that page, the count, and its own empty state when nothing matches. A changed condition is a new query without page, which is the first page.
  • What the script adds. It answers as the reader types or ticks, without a round trip, keeps the page number, moves the conditions into the drawer, and reveals what only it can work: the Filters button and "Clear all". It reads the conditions from the form each time, new FormData(form), and keeps no copy of them; the page number is the one thing it holds. A project that keeps the script points its draw() at a request for that query and writes the same query to the address with history.replaceState, so a reload or a shared link shows the same results.

The example imports search, sort and paginate from the filter bar's query.js, which stand in for that request. They are part of the demonstration, not of @master/ui: the library publishes no query engine.

#When to use it

  • Use a results page when the things found are read one at a time and each has a page of its own: articles, guides, templates, listings, people.
  • Use a table view when the rows are compared across columns, selected and acted on in bulk. It is a block inside an application's page, with its own search, sort and pages.
  • Use a filter bar when a condition is a field, a comparison and a value, and several are combined. A sidebar of checkboxes suits a few fixed groups that are always worth showing.
  • Use a dashboard when the page summarizes: figures and charts first, and a list only as the way in.

#Accessibility

  • The landmarks are the header with its Main navigation, the main region, the search form, named Resources, the Pagination navigation, and the footer with its own. The first link is a skip link to the main region, which has tabindex="-1".
  • Source order is reading order at every width: title, search, conditions, count and sort, results, pages. The drawer is written last in the main region and is in nobody's way until it opens.
  • The types are a <fieldset> with a <legend>; each count is in its checkbox's label. The Cards / List switch is a radiogroup of native radios, and the sort a native <select> with a label.
  • The count has role="status", so a change of conditions is announced without moving focus: "4 of 12 resources", or "No resources match". A second, visually hidden status says the page and the range after a pagination link is pressed, and focus stays on the current page's link.
  • The results are under a visually hidden <h2>, "Results", and each title is an <h3>, so a reader can jump to the results and from one to the next. A card's title is its link, card-link, and the whole card is its target.
  • The drawer is a native modal <dialog> named by its title. Focus goes to the first checkbox when it opens; Esc, a press outside (closedby="any"), the close button and "Show results" close it, and focus returns to the Filters button. The button's name says how many filters are applied.
  • "Clear all" and the empty state's button remove themselves when pressed, so focus goes to the search field.