Pagination new 翻页器(分页) web

    标本可交互,可以直接操作。

    Anatomy — every part, named解剖 —— 每个部件的名字

    1. 1 Previous / next上一页/下一页 button

      Step one page; disabled at the ends.

      一次翻一页,到两端时禁用。

      Prompt fragmentPrompt 片段

      previous and next arrow buttons, disabled at the ends

      两端禁用的上一页/下一页箭头

    2. 2 Page buttons页码按钮 button

      Numbered pages near the current one plus first and last.

      当前页附近的页码,加上第一页和最后一页。

      Prompt fragmentPrompt 片段

      numbered buttons for first, last and the current page’s neighbours

      第一页、最后一页和当前页相邻页的数字按钮

    3. 3 Current page当前页 aria-current

      The page you are on, clearly marked.

      清楚标出所在的页。

      Prompt fragmentPrompt 片段

      the current page filled and marked with aria-current

      当前页填充高亮并加 aria-current

    4. 4 Ellipsis省略号 …

      Stands in for skipped page ranges.

      代表被收起的页码区间。

      Prompt fragmentPrompt 片段

      an ellipsis for collapsed page ranges

      收起页码区间的省略号

    Prompt — paste into your agentPrompt —— 直接粘贴给你的代理

    Build pagination for a 20-page list: a nav landmark labelled Pagination with previous and next arrow buttons that disable on the first and last page; always show page 1, the last page, and the current page with one neighbour on each side, collapsing gaps larger than one into an ellipsis; mark the current page with aria-current="page" and a filled style; give each button an accessible label like 'Page 4'; update the results above when the page changes.

    给一个 20 页的列表做翻页器:用 nav 标记并标注「分页」,两端是上一页/下一页箭头,在第一页和最后一页时禁用;始终显示第 1 页、最后一页,以及当前页和左右各一个相邻页,间隔超过一页的用省略号代替;当前页用 aria-current="page" 标记并填充高亮;每个按钮有可读的标签,比如「第 4 页」;翻页时更新上方的结果。

    Debug prompt — when it misbehaves调试 Prompt —— 当它不听话时

    Debug my pagination. Check that the ellipsis logic never shows a gap of exactly one page as '…'; first and last pages are always reachable; previous/next disable at the ends; aria-current marks exactly one page; the bar keeps a stable width so buttons do not jump; focus stays on the control after changing page; and the URL or state reflects the page so refresh and back work. The symptom:

    调试我的翻页器。检查:省略号逻辑是否把恰好只隔一页的情况也显示成「…」;第一页和最后一页是否始终可达;上一页/下一页是否在两端禁用;aria-current 是否只标在一个页码上;页码栏宽度是否稳定、按钮不会跳动;翻页后焦点是否仍在控件上;以及网址或状态是否记录页码,刷新和返回都能回到同一页。症状是:

    In code代码里叫什么

    Framework框架Symbol符号Note说明
    HTML <nav aria-label="Pagination"> a labelled navigation landmark带标签的导航区域
    ARIA aria-current="page" marks the current page button标出当前页按钮
    Pattern first · current±1 · last + ellipsis keeps the bar short for large page counts页数很多时保持页码栏简短

    See also相关词条

    我的参考集

    组合知名网站、UI 元素、视觉风格和平面设计案例,导出给 AI。

    你的下一份设计,从这里开始。

    在任意案例旁点击「加入参考」,就能把品牌、组件、风格和平面设计案例组合成一份 AI 设计说明。

    搜索参考库Search the library

    输入关键词,搜索所有参考。