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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
<div class="flex flex-col gap-8"> <div class="flex flex-col gap-2"> <span class="text-xs text-muted-foreground">First page</span> <div class="@container w-full"> <div class="flex w-full flex-col items-center gap-2 @lg:flex-row @lg:justify-between"> <p class="text-sm text-muted-foreground whitespace-nowrap">Showing 1–25 of 240</p> <nav aria-label="Pages" class="mx-auto flex w-full justify-center"> <ul class="flex flex-row flex-wrap items-center justify-center gap-1"> <li> <span class="inline-flex items-center gap-1 px-2.5 py-2 text-sm text-muted-foreground opacity-50"><i data-lucide="chevron-left" class="inline-block shrink-0 w-4 h-4" aria-hidden="true"></i> <span class="hidden @md:inline">Previous</span></span> </li> <li> <a aria-current="page" href="?page=1" class="inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-sm text-sm font-medium transition-all focus:outline-none focus:ring-2 focus:ring-primary focus:ring-offset-1 ring-offset-background text-primary underline-offset-4 hover:underline px-4 py-2 size-9 border border-input bg-background">1</a> </li> <li> <a href="?page=2" class="inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-sm text-sm font-medium transition-all focus:outline-none focus:ring-2 focus:ring-primary focus:ring-offset-1 ring-offset-background text-primary underline-offset-4 hover:underline px-4 py-2 size-9">2</a> </li> <li> <a href="?page=3" class="inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-sm text-sm font-medium transition-all focus:outline-none focus:ring-2 focus:ring-primary focus:ring-offset-1 ring-offset-background text-primary underline-offset-4 hover:underline px-4 py-2 size-9">3</a> </li> <li> <span class="flex size-9 items-center justify-center text-muted-foreground" aria-hidden="true">…<span class="sr-only">More pages</span></span> </li> <li> <a href="?page=10" class="inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-sm text-sm font-medium transition-all focus:outline-none focus:ring-2 focus:ring-primary focus:ring-offset-1 ring-offset-background text-primary underline-offset-4 hover:underline px-4 py-2 size-9">10</a> </li> <li> <a aria-label="Go to next page" href="?page=2" class="inline-flex items-center justify-center whitespace-nowrap rounded-sm text-sm font-medium transition-all focus:outline-none focus:ring-2 focus:ring-primary focus:ring-offset-1 ring-offset-background text-primary underline-offset-4 hover:underline h-9 py-2 gap-1 px-2.5"><span class="hidden @md:inline">Next</span><i data-lucide="chevron-right" class="inline-block shrink-0 w-4 h-4" aria-hidden="true"></i> </a> </li> </ul> </nav></div> </div> </div> <div class="flex flex-col gap-2"> <span class="text-xs text-muted-foreground">Middle</span> <div class="@container w-full"> <div class="flex w-full flex-col items-center gap-2 @lg:flex-row @lg:justify-between"> <p class="text-sm text-muted-foreground whitespace-nowrap">Showing 101–125 of 240</p> <nav aria-label="Pages" class="mx-auto flex w-full justify-center"> <ul class="flex flex-row flex-wrap items-center justify-center gap-1"> <li> <a aria-label="Go to previous page" href="?page=4" class="inline-flex items-center justify-center whitespace-nowrap rounded-sm text-sm font-medium transition-all focus:outline-none focus:ring-2 focus:ring-primary focus:ring-offset-1 ring-offset-background text-primary underline-offset-4 hover:underline h-9 py-2 gap-1 px-2.5"><i data-lucide="chevron-left" class="inline-block shrink-0 w-4 h-4" aria-hidden="true"></i> <span class="hidden @md:inline">Previous</span></a> </li> <li> <a href="?page=1" class="inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-sm text-sm font-medium transition-all focus:outline-none focus:ring-2 focus:ring-primary focus:ring-offset-1 ring-offset-background text-primary underline-offset-4 hover:underline px-4 py-2 size-9">1</a> </li> <li> <span class="flex size-9 items-center justify-center text-muted-foreground" aria-hidden="true">…<span class="sr-only">More pages</span></span> </li> <li> <a href="?page=3" class="inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-sm text-sm font-medium transition-all focus:outline-none focus:ring-2 focus:ring-primary focus:ring-offset-1 ring-offset-background text-primary underline-offset-4 hover:underline px-4 py-2 size-9">3</a> </li> <li> <a href="?page=4" class="inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-sm text-sm font-medium transition-all focus:outline-none focus:ring-2 focus:ring-primary focus:ring-offset-1 ring-offset-background text-primary underline-offset-4 hover:underline px-4 py-2 size-9">4</a> </li> <li> <a aria-current="page" href="?page=5" class="inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-sm text-sm font-medium transition-all focus:outline-none focus:ring-2 focus:ring-primary focus:ring-offset-1 ring-offset-background text-primary underline-offset-4 hover:underline px-4 py-2 size-9 border border-input bg-background">5</a> </li> <li> <a href="?page=6" class="inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-sm text-sm font-medium transition-all focus:outline-none focus:ring-2 focus:ring-primary focus:ring-offset-1 ring-offset-background text-primary underline-offset-4 hover:underline px-4 py-2 size-9">6</a> </li> <li> <a href="?page=7" class="inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-sm text-sm font-medium transition-all focus:outline-none focus:ring-2 focus:ring-primary focus:ring-offset-1 ring-offset-background text-primary underline-offset-4 hover:underline px-4 py-2 size-9">7</a> </li> <li> <span class="flex size-9 items-center justify-center text-muted-foreground" aria-hidden="true">…<span class="sr-only">More pages</span></span> </li> <li> <a href="?page=10" class="inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-sm text-sm font-medium transition-all focus:outline-none focus:ring-2 focus:ring-primary focus:ring-offset-1 ring-offset-background text-primary underline-offset-4 hover:underline px-4 py-2 size-9">10</a> </li> <li> <a aria-label="Go to next page" href="?page=6" class="inline-flex items-center justify-center whitespace-nowrap rounded-sm text-sm font-medium transition-all focus:outline-none focus:ring-2 focus:ring-primary focus:ring-offset-1 ring-offset-background text-primary underline-offset-4 hover:underline h-9 py-2 gap-1 px-2.5"><span class="hidden @md:inline">Next</span><i data-lucide="chevron-right" class="inline-block shrink-0 w-4 h-4" aria-hidden="true"></i> </a> </li> </ul> </nav></div> </div> </div> <div class="flex flex-col gap-2"> <span class="text-xs text-muted-foreground">Last page</span> <div class="@container w-full"> <div class="flex w-full flex-col items-center gap-2 @lg:flex-row @lg:justify-between"> <p class="text-sm text-muted-foreground whitespace-nowrap">Showing 226–240 of 240</p> <nav aria-label="Pages" class="mx-auto flex w-full justify-center"> <ul class="flex flex-row flex-wrap items-center justify-center gap-1"> <li> <a aria-label="Go to previous page" href="?page=9" class="inline-flex items-center justify-center whitespace-nowrap rounded-sm text-sm font-medium transition-all focus:outline-none focus:ring-2 focus:ring-primary focus:ring-offset-1 ring-offset-background text-primary underline-offset-4 hover:underline h-9 py-2 gap-1 px-2.5"><i data-lucide="chevron-left" class="inline-block shrink-0 w-4 h-4" aria-hidden="true"></i> <span class="hidden @md:inline">Previous</span></a> </li> <li> <a href="?page=1" class="inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-sm text-sm font-medium transition-all focus:outline-none focus:ring-2 focus:ring-primary focus:ring-offset-1 ring-offset-background text-primary underline-offset-4 hover:underline px-4 py-2 size-9">1</a> </li> <li> <span class="flex size-9 items-center justify-center text-muted-foreground" aria-hidden="true">…<span class="sr-only">More pages</span></span> </li> <li> <a href="?page=8" class="inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-sm text-sm font-medium transition-all focus:outline-none focus:ring-2 focus:ring-primary focus:ring-offset-1 ring-offset-background text-primary underline-offset-4 hover:underline px-4 py-2 size-9">8</a> </li> <li> <a href="?page=9" class="inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-sm text-sm font-medium transition-all focus:outline-none focus:ring-2 focus:ring-primary focus:ring-offset-1 ring-offset-background text-primary underline-offset-4 hover:underline px-4 py-2 size-9">9</a> </li> <li> <a aria-current="page" href="?page=10" class="inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-sm text-sm font-medium transition-all focus:outline-none focus:ring-2 focus:ring-primary focus:ring-offset-1 ring-offset-background text-primary underline-offset-4 hover:underline px-4 py-2 size-9 border border-input bg-background">10</a> </li> <li> <span class="inline-flex items-center gap-1 px-2.5 py-2 text-sm text-muted-foreground opacity-50"><span class="hidden @md:inline">Next</span><i data-lucide="chevron-right" class="inline-block shrink-0 w-4 h-4" aria-hidden="true"></i> </span> </li> </ul> </nav></div> </div> </div> <div class="flex flex-col gap-2"> <span class="text-xs text-muted-foreground">Long range, collapsed</span> <div class="@container w-full"> <div class="flex w-full flex-col items-center gap-2 @lg:flex-row @lg:justify-between"> <p class="text-sm text-muted-foreground whitespace-nowrap">Showing 1226–1250 of 2500</p> <nav aria-label="Pages" class="mx-auto flex w-full justify-center"> <ul class="flex flex-row flex-wrap items-center justify-center gap-1"> <li> <a aria-label="Go to previous page" href="?page=49" class="inline-flex items-center justify-center whitespace-nowrap rounded-sm text-sm font-medium transition-all focus:outline-none focus:ring-2 focus:ring-primary focus:ring-offset-1 ring-offset-background text-primary underline-offset-4 hover:underline h-9 py-2 gap-1 px-2.5"><i data-lucide="chevron-left" class="inline-block shrink-0 w-4 h-4" aria-hidden="true"></i> <span class="hidden @md:inline">Previous</span></a> </li> <li> <a href="?page=1" class="inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-sm text-sm font-medium transition-all focus:outline-none focus:ring-2 focus:ring-primary focus:ring-offset-1 ring-offset-background text-primary underline-offset-4 hover:underline px-4 py-2 size-9">1</a> </li> <li> <span class="flex size-9 items-center justify-center text-muted-foreground" aria-hidden="true">…<span class="sr-only">More pages</span></span> </li> <li> <a href="?page=48" class="inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-sm text-sm font-medium transition-all focus:outline-none focus:ring-2 focus:ring-primary focus:ring-offset-1 ring-offset-background text-primary underline-offset-4 hover:underline px-4 py-2 size-9">48</a> </li> <li> <a href="?page=49" class="inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-sm text-sm font-medium transition-all focus:outline-none focus:ring-2 focus:ring-primary focus:ring-offset-1 ring-offset-background text-primary underline-offset-4 hover:underline px-4 py-2 size-9">49</a> </li> <li> <a aria-current="page" href="?page=50" class="inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-sm text-sm font-medium transition-all focus:outline-none focus:ring-2 focus:ring-primary focus:ring-offset-1 ring-offset-background text-primary underline-offset-4 hover:underline px-4 py-2 size-9 border border-input bg-background">50</a> </li> <li> <a href="?page=51" class="inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-sm text-sm font-medium transition-all focus:outline-none focus:ring-2 focus:ring-primary focus:ring-offset-1 ring-offset-background text-primary underline-offset-4 hover:underline px-4 py-2 size-9">51</a> </li> <li> <a href="?page=52" class="inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-sm text-sm font-medium transition-all focus:outline-none focus:ring-2 focus:ring-primary focus:ring-offset-1 ring-offset-background text-primary underline-offset-4 hover:underline px-4 py-2 size-9">52</a> </li> <li> <span class="flex size-9 items-center justify-center text-muted-foreground" aria-hidden="true">…<span class="sr-only">More pages</span></span> </li> <li> <a href="?page=100" class="inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-sm text-sm font-medium transition-all focus:outline-none focus:ring-2 focus:ring-primary focus:ring-offset-1 ring-offset-background text-primary underline-offset-4 hover:underline px-4 py-2 size-9">100</a> </li> <li> <a aria-label="Go to next page" href="?page=51" class="inline-flex items-center justify-center whitespace-nowrap rounded-sm text-sm font-medium transition-all focus:outline-none focus:ring-2 focus:ring-primary focus:ring-offset-1 ring-offset-background text-primary underline-offset-4 hover:underline h-9 py-2 gap-1 px-2.5"><span class="hidden @md:inline">Next</span><i data-lucide="chevron-right" class="inline-block shrink-0 w-4 h-4" aria-hidden="true"></i> </a> </li> </ul> </nav></div> </div> </div> <div class="flex flex-col gap-2"> <span class="text-xs text-muted-foreground">Single page (renders nothing)</span> </div></div>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
<% examples = { "First page" => [240, 1], "Middle" => [240, 5], "Last page" => [240, 10], "Long range, collapsed" => [2500, 50], "Single page (renders nothing)" => [10, 1] } %><div class="flex flex-col gap-8"> <% examples.each do |label, (count, page)| %> <div class="flex flex-col gap-2"> <span class="text-xs text-muted-foreground"><%= label %></span> <%= render(UI::Pagination.new(pagy: Pagy::Offset.new(count: count, page: page, limit: 25))) %> </div> <% end %></div>No notes provided.
No params configured.