跳到內容
欄目
Fiesta

list-bar-search

清單畫面 一般嘅清單畫面:標題、工具列同行,喺桌面同手機都用得。

淨係搜尋嘅清單用嘅獨立搜尋表單。普通嘅 method="get" 表單。

每個例子都真係用得,不過入面啲連結唔會帶你去邊度。 HTML 顯示可以複製嘅標記。

有查詢

呢個 ✕ 係一條連結,連去拎走咗查詢嘅同一個畫面。狀態篩選放喺隱藏輸入度,所以會保留。

預覽

將呢段放入 <div rst-list> 入面。

<search>
  <form rst-search method="get" action="/comments">
    <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="spam" placeholder="搜尋留言" aria-label="搜尋留言">
    <a rst-search-clear href="/comments?status=held" 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="status" value="held">
    <button class="rst-sr-only" type="submit">搜尋</button>
  </form>
</search>

喺應用程式入面,呢個會去到 /comments, /comments?status=held。喺呢度,佢嘅連結同表格都唔會去任何地方。

有查詢,第 4 頁

頁碼放喺隱藏輸入度,所以新嘅搜尋會將 page=4 帶入一個已經冇四頁嘅結果。✕ 連結會拎走佢:將佢指去清單嘅第一頁。

預覽

將呢段放入 <div rst-list> 入面。

<search>
  <form rst-search method="get" action="/comments">
    <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="spam" placeholder="搜尋留言" aria-label="搜尋留言">
    <a rst-search-clear href="/comments" 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="page" value="4">
    <button class="rst-sr-only" type="submit">搜尋</button>
  </form>
</search>

喺應用程式入面,呢個會去到 /comments。喺呢度,佢嘅連結同表格都唔會去任何地方。

空,無障礙名稱嚟自目錄

冇 placeholder。輸入框嘅無障礙名稱係佢嘅 aria-label,由應用程式用頁面嘅語言寫。

預覽

將呢段放入 <div rst-list> 入面。

<search>
  <form rst-search method="get" action="/comments">
    <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" aria-label="搜尋">
    <button class="rst-sr-only" type="submit">搜尋</button>
  </form>
</search>

喺應用程式入面,呢個會去到 /comments。喺呢度,佢嘅連結同表格都唔會去任何地方。