dropdown
清單畫面 一般嘅清單畫面:標題、工具列同行,喺桌面同手機都用得。
一個完全冇 JavaScript 嘅展開塊:一個 summary 掣,下面係一板普通連結。要放喺一行入面,貼住佢作用嘅嘢,唔好自己獨佔一行。
每個例子都真係用得,不過入面啲連結唔會帶你去邊度。 HTML 顯示可以複製嘅標記。
套咗一個選擇嘅篩選選單
<div rst-box-head >
<h2 >文章</h2 >
<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?sort=newest" 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?sort=oldest" >最舊</a >
<a href ="/posts?sort=title" >按標題</a >
</div >
</details >
</div >
喺應用程式入面,呢個會去到 /posts?sort=newest, /posts?sort=oldest, /posts?sort=title。喺呢度,佢嘅連結同表格都唔會去任何地方。
匿喺頁首溢出選單同清單列篩選背後嘅 details/summary 選單,加埋一個可以摘走嘅已套用篩選標籤。
<div rst-list >
<div rst-lbar >
<details rst-dropdown name ="rst-menus" >
<summary >
篩選
<span rst-caret aria-hidden ="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 ="m6 9 6 6 6-6" /></svg >
</span >
<span class ="rst-sr-only" >篩選訂單:已付款</span >
</summary >
<div rst-dropdown-menu >
<a aria-current ="true" href ="/orders?status=paid" >已付款</a >
<details rst-menu-group name ="rst-menus-price" open >
<summary >價錢</summary >
<div >
<a href ="/orders?price=free" >免費</a >
</div >
</details >
</div >
</details >
<span rst-ftok >
<span rst-ftok-k >已付款</span >
<a href ="/orders" aria-label ="移除篩選:已付款" >✕</a >
</span >
</div >
</div >
喺應用程式入面,呢個會去到 /orders, /orders?price=free, /orders?status=paid。喺呢度,佢嘅連結同表格都唔會去任何地方。