x
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
<div class="p-8 flex flex-col gap-6"> <nav class="midwest-pagination variant-default" aria-label="Pagination"> <span class="midwest-pagination-btn is-prev is-disabled" aria-disabled="true" aria-label="Previous page"> <div class="midwest-icon " aria-hidden="true"> <div class="midwest-icon-inner"> <svg xmlns="http://www.w3.org/2000/svg" class="Midwest-Icon__Svg" viewbox="0 0 512 512" focusable="false" role="img" aria-label="Arrow back"><title>Arrow back</title> <path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="48" d="M244 400L100 256l144-144M120 256h292"></path></svg> </div> </div> </span> <a class="midwest-pagination-btn is-next" aria-label="Go to next page" href="/posts?cursor=eyJpZCI6MTAwfQ"> <div class="midwest-icon " aria-hidden="true"> <div class="midwest-icon-inner"> <svg xmlns="http://www.w3.org/2000/svg" class="Midwest-Icon__Svg" viewbox="0 0 512 512" focusable="false" role="img" aria-label="Arrow forward"><title>Arrow forward</title> <path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="48" d="M268 112l144 144-144 144M392 256H100"></path></svg> </div> </div> </a> </nav> <nav class="midwest-pagination variant-default" aria-label="Pagination"> <a class="midwest-pagination-btn is-prev" aria-label="Go to previous page" href="/posts?cursor=eyJpZCI6NTB9"> <div class="midwest-icon " aria-hidden="true"> <div class="midwest-icon-inner"> <svg xmlns="http://www.w3.org/2000/svg" class="Midwest-Icon__Svg" viewbox="0 0 512 512" focusable="false" role="img" aria-label="Arrow back"><title>Arrow back</title> <path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="48" d="M244 400L100 256l144-144M120 256h292"></path></svg> </div> </div> </a> <a class="midwest-pagination-btn is-next" aria-label="Go to next page" href="/posts?cursor=eyJpZCI6MTUwfQ"> <div class="midwest-icon " aria-hidden="true"> <div class="midwest-icon-inner"> <svg xmlns="http://www.w3.org/2000/svg" class="Midwest-Icon__Svg" viewbox="0 0 512 512" focusable="false" role="img" aria-label="Arrow forward"><title>Arrow forward</title> <path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="48" d="M268 112l144 144-144 144M392 256H100"></path></svg> </div> </div> </a> </nav> <nav class="midwest-pagination variant-default" aria-label="Pagination"> <a class="midwest-pagination-btn is-prev" aria-label="Go to previous page" href="/posts?cursor=eyJpZCI6MjAwfQ"> <div class="midwest-icon " aria-hidden="true"> <div class="midwest-icon-inner"> <svg xmlns="http://www.w3.org/2000/svg" class="Midwest-Icon__Svg" viewbox="0 0 512 512" focusable="false" role="img" aria-label="Arrow back"><title>Arrow back</title> <path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="48" d="M244 400L100 256l144-144M120 256h292"></path></svg> </div> </div> </a> <span class="midwest-pagination-btn is-next is-disabled" aria-disabled="true" aria-label="Next page"> <div class="midwest-icon " aria-hidden="true"> <div class="midwest-icon-inner"> <svg xmlns="http://www.w3.org/2000/svg" class="Midwest-Icon__Svg" viewbox="0 0 512 512" focusable="false" role="img" aria-label="Arrow forward"><title>Arrow forward</title> <path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="48" d="M268 112l144 144-144 144M392 256H100"></path></svg> </div> </div> </span> </nav></div>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
<div class="p-8 flex flex-col gap-6"> <%# First page — prev disabled, next available %> <%= midwest_pagination( cursor_url: ->(c) { "/posts?cursor=#{c}" }, prev_cursor: nil, next_cursor: "eyJpZCI6MTAwfQ" ) %> <%# Middle — both directions available %> <%= midwest_pagination( cursor_url: ->(c) { "/posts?cursor=#{c}" }, prev_cursor: "eyJpZCI6NTB9", next_cursor: "eyJpZCI6MTUwfQ" ) %> <%# Last page — next disabled, prev available %> <%= midwest_pagination( cursor_url: ->(c) { "/posts?cursor=#{c}" }, prev_cursor: "eyJpZCI6MjAwfQ", next_cursor: nil ) %></div>Cursor Based
Cursor-based pagination for APIs that return next_cursor / prev_cursor
tokens instead of a total page count. Pass a cursor_url: proc that
builds the URL for a given cursor string. Set either cursor to nil to
disable the corresponding arrow (first or last page).
No params configured.
No assets to display.
Add a .js or .css file alongside the component to see it here.
Figma embed for Pagination/cursor_based
Annotate a preview to embed its Figma design here:
@figma "https://figma.com/..."