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
<div class="p-8"> <nav class="midwest-pagination variant-default" aria-label="Pagination"> <div class="midwest-pagination-controls"> <a class="midwest-pagination-btn is-prev" aria-label="Go to previous page" href="/posts?page=4"> <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" aria-label="Go to page 1" href="/posts?page=1">1</a> <span class="midwest-pagination-ellipsis" aria-hidden="true">…</span> <a class="midwest-pagination-btn" aria-label="Go to page 3" href="/posts?page=3">3</a> <a class="midwest-pagination-btn" aria-label="Go to page 4" href="/posts?page=4">4</a> <span class="midwest-pagination-btn is-current" aria-current="page">5</span> <a class="midwest-pagination-btn" aria-label="Go to page 6" href="/posts?page=6">6</a> <a class="midwest-pagination-btn" aria-label="Go to page 7" href="/posts?page=7">7</a> <span class="midwest-pagination-ellipsis" aria-hidden="true">…</span> <a class="midwest-pagination-btn" aria-label="Go to page 20" href="/posts?page=20">20</a> <a class="midwest-pagination-btn is-next" aria-label="Go to next page" href="/posts?page=6"> <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> </div> </nav></div>1
2
3
4
5
6
7
8
9
10
11
12
13
14
<div class="p-8"> <%= midwest_pagination( current_page: (params[:current_page] || 5).to_i, total_pages: (params[:total_pages] || 20).to_i, window: (params[:window] || 2).to_i, gap: (params[:gap] || 1).to_i, per_page: 25, variant: (params[:variant] || "default").to_sym, show_jump_to: params[:show_jump_to] == true, show_per_page: params[:show_per_page] == true, page_url: ->(p) { "/posts?page=#{p}" }, per_page_url: ->(n) { "/posts?per_page=#{n}&page=1" } ) %></div>Playground
Live-editable parameters. Supply a page_url to see real link hrefs.
| Param | Description | Input |
|---|---|---|
|
Current page |
|
|
|
Total pages |
|
|
|
Pages shown around current (default: 2) |
|
|
|
Pages shown at each edge (default: 1) |
|
|
|
Variant |
|
|
|
Show jump-to-page form |
|
|
|
Show rows-per-page selector |
|
No assets to display.
Add a .js or .css file alongside the component to see it here.
Figma embed for Pagination/playground
Annotate a preview to embed its Figma design here:
@figma "https://figma.com/..."