@@ -4,9 +4,11 @@ import FwbPaginationExampleIcons from './pagination/examples/FwbPaginationExampl
4
4
import FwbPaginationExampleNavigation from ' ./pagination/examples/FwbPaginationExampleNavigation.vue' ;
5
5
import FwbPaginationExampleNavigationIcons from ' ./pagination/examples/FwbPaginationExampleNavigationIcons.vue' ;
6
6
import FwbPaginationExampleSlots from ' ./pagination/examples/FwbPaginationExampleSlots.vue' ;
7
+ import FwbPaginationExampleSlotsAdvanced from ' ./pagination/examples/FwbPaginationExampleSlotsAdvanced.vue' ;
7
8
import FwbPaginationExampleTable from ' ./pagination/examples/FwbPaginationExampleTable.vue' ;
8
9
import FwbPaginationExampleCustomLength from ' ./pagination/examples/FwbPaginationExampleCustomLength.vue' ;
9
10
import FwbPaginationExampleCustomLabels from ' ./pagination/examples/FwbPaginationExampleCustomLabels.vue' ;
11
+ import FwbPaginationExampleFirstLast from ' ./pagination/examples/FwbPaginationExampleFirstLast.vue' ;
10
12
</script >
11
13
12
14
# Vue Pagination - Flowbite
@@ -145,6 +147,40 @@ const currentPage = ref(1)
145
147
</script>
146
148
```
147
149
150
+ ## First and last
151
+
152
+ <fwb-pagination-example-first-last />
153
+ ``` vue
154
+ <template>
155
+ <fwb-pagination
156
+ v-model="currentPage"
157
+ :total-pages="100"
158
+ enable-first-last
159
+ />
160
+ <fwb-pagination
161
+ v-model="currentPage"
162
+ :total-pages="100"
163
+ large
164
+ enable-first-last
165
+ />
166
+ <fwb-pagination
167
+ v-model="currentPage"
168
+ :total-pages="100"
169
+ large
170
+ enable-first-last
171
+ show-icons
172
+ />
173
+ </template>
174
+
175
+ <script setup>
176
+ import { FwbPagination } from 'flowbite-vue'
177
+ import { ref } from 'vue'
178
+
179
+ const currentPage = ref(1)
180
+ </script>
181
+ ```
182
+
183
+
148
184
## Table data pagination
149
185
You can use the following markup to show the number of data shown inside a table element and also the previous and next action buttons.
150
186
To use that layout you have to pass required props:
@@ -233,6 +269,84 @@ const currentPage = ref(1)
233
269
</script>
234
270
```
235
271
272
+ ## Advanced slots example
273
+
274
+ <fwb-pagination-example-slots-advanced />
275
+
276
+ ``` vue
277
+ <template>
278
+ <fwb-pagination
279
+ v-model="currentPage"
280
+ :total-items="100"
281
+ enable-first-last
282
+ >
283
+ <template #first-button="{ disabled, setPage }">
284
+ <button
285
+ class="disabled:cursor-not-allowed ml-0 flex h-8 items-center justify-center border border-purple-300 bg-purple-200 px-3 leading-tight text-gray-500 first:rounded-l-lg last:rounded-r-lg hover:bg-purple-300 hover:text-gray-700 dark:border-gray-700 dark:bg-gray-800 dark:text-gray-400 dark:hover:bg-gray-700 dark:hover:text-white"
286
+ :disabled="disabled"
287
+ @click="setPage()"
288
+ >
289
+ First page
290
+ </button>
291
+ </template>
292
+
293
+ <template #last-button="{ disabled, setPage, page }">
294
+ <button
295
+ class="disabled:cursor-not-allowed ml-0 flex h-8 items-center justify-center border border-purple-300 bg-purple-200 px-3 leading-tight text-gray-500 first:rounded-l-lg last:rounded-r-lg hover:bg-purple-300 hover:text-gray-700 dark:border-gray-700 dark:bg-gray-800 dark:text-gray-400 dark:hover:bg-gray-700 dark:hover:text-white"
296
+ :disabled="disabled"
297
+ @click="setPage()"
298
+ >
299
+ Last page ({{ page }})
300
+ </button>
301
+ </template>
302
+
303
+ <template #prev-button="{ disabled, decreasePage }">
304
+ <button
305
+ class="disabled:cursor-not-allowed ml-0 flex h-8 items-center justify-center border border-purple-300 bg-purple-200 px-3 leading-tight text-gray-500 first:rounded-l-lg last:rounded-r-lg hover:bg-purple-300 hover:text-gray-700 dark:border-gray-700 dark:bg-gray-800 dark:text-gray-400 dark:hover:bg-gray-700 dark:hover:text-white"
306
+ :disabled="disabled"
307
+ @click="decreasePage()"
308
+ >
309
+ Prev page
310
+ </button>
311
+ </template>
312
+
313
+ <template #next-button="{ disabled, increasePage }">
314
+ <button
315
+ class="disabled:cursor-not-allowed ml-0 flex h-8 items-center justify-center border border-purple-300 bg-purple-200 px-3 leading-tight text-gray-500 first:rounded-l-lg last:rounded-r-lg hover:bg-purple-300 hover:text-gray-700 dark:border-gray-700 dark:bg-gray-800 dark:text-gray-400 dark:hover:bg-gray-700 dark:hover:text-white"
316
+ :disabled="disabled"
317
+ @click="increasePage()"
318
+ >
319
+ Next page
320
+ </button>
321
+ </template>
322
+
323
+ <template #page-button="{ disabled, page, setPage }">
324
+ <button
325
+ class="disabled:cursor-not-allowed ml-0 flex h-8 items-center justify-center border border-purple-300 px-3 leading-tight text-gray-500 first:rounded-l-lg last:rounded-r-lg hover:text-gray-700 dark:border-gray-700 dark:bg-gray-800 dark:text-gray-400 dark:hover:bg-gray-700 dark:hover:text-white"
326
+ :class="{
327
+ 'bg-purple-200 hover:bg-purple-300': !disabled,
328
+ 'bg-purple-300': disabled
329
+ }"
330
+ :disabled="disabled"
331
+ @click="setPage(page)"
332
+ >
333
+ {{ page }}
334
+ </button>
335
+ </template>
336
+ </fwb-pagination>
337
+ Current page: {{ currentPage }}
338
+ </template>
339
+
340
+ <script lang="ts" setup>
341
+ import { ref } from 'vue'
342
+
343
+ import { FwbPagination } from '../../../../src/index'
344
+
345
+ const currentPage = ref<number>(1)
346
+ </script>
347
+
348
+ ```
349
+
236
350
## API
237
351
238
352
### Props
0 commit comments