跳到内容
栏目
Fiesta

list-bar

列表页 通用列表页:标题、工具栏和行,桌面和移动端都适用。

列表卡片顶部的工具栏,带搜索和筛选。

每个示例都能真实操作,但其中的链接不会跳转到任何地方。 HTML 显示可复制的标记。

搜索,外加一个筛选下拉菜单

预览

把这段放进 <div rst-list> 里。

<div rst-lbar>
  <search>
    <form rst-search method="get" action="/posts">
      <svg class="icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><circle cx="11" cy="11" r="8"/><path d="m21 21-4.3-4.3"/></svg>
      <input type="search" name="q" value="release" placeholder="搜索文章" aria-label="搜索文章">
      <a rst-search-clear href="/posts?sort=newest" aria-label="清除搜索">
        <svg class="icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M18 6 6 18"/><path d="m6 6 12 12"/></svg>
      </a>
      <input type="hidden" name="sort" value="newest">
      <button class="rst-sr-only" type="submit">搜索</button>
    </form>
  </search>
  <details rst-dropdown name="rst-menus">
    <summary rst-btn aria-label="按状态筛选:已付款">
      已付款
      <svg class="icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="m6 9 6 6 6-6"/></svg>
    </summary>
    <div rst-dropdown-menu>
      <a href="/posts">全部</a>
      <a href="/posts?status=paid" aria-current="true">已付款 <svg class="icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M20 6 9 17l-5-5"/></svg></a>
      <a href="/posts?status=free">免费</a>
    </div>
  </details>
</div>

在应用里,这会到达 /posts, /posts?sort=newest, /posts?status=free, /posts?status=paid。在这里,它的链接和表单哪儿也不去。