| 1 |
--- |
| 2 |
id: Pagination |
| 3 |
section: components |
| 4 |
cssPrefix: pf-v6-c-pagination |
| 5 |
propComponents: ['Pagination', PaginationTitles, PerPageOptions, PaginationToggleTemplateProps] |
| 6 |
ouia: true |
| 7 |
--- |
| 8 |
|
| 9 |
import { Fragment, useState, useRef, useLayoutEffect } from 'react'; |
| 10 |
|
| 11 |
## Examples |
| 12 |
|
| 13 |
### Top |
| 14 |
|
| 15 |
```ts file="./PaginationTop.tsx" |
| 16 |
|
| 17 |
``` |
| 18 |
|
| 19 |
### Bottom |
| 20 |
|
| 21 |
```ts file="./PaginationBottom.tsx" |
| 22 |
|
| 23 |
``` |
| 24 |
|
| 25 |
### Indeterminate |
| 26 |
|
| 27 |
By not passing `itemCount` and passing `toggleTemplate` you can customize the toggle with text. |
| 28 |
|
| 29 |
```ts file="./PaginationIndeterminate.tsx" |
| 30 |
|
| 31 |
``` |
| 32 |
|
| 33 |
### Disabled |
| 34 |
|
| 35 |
```ts file="./PaginationDisabled.tsx" |
| 36 |
|
| 37 |
``` |
| 38 |
|
| 39 |
### No items |
| 40 |
|
| 41 |
```ts file="./PaginationNoItems.tsx" |
| 42 |
|
| 43 |
``` |
| 44 |
|
| 45 |
### One page |
| 46 |
|
| 47 |
```ts file="./PaginationOnePage.tsx" |
| 48 |
|
| 49 |
``` |
| 50 |
|
| 51 |
### Compact |
| 52 |
|
| 53 |
```ts file="./PaginationCompact.tsx" |
| 54 |
|
| 55 |
``` |
| 56 |
|
| 57 |
### Offset |
| 58 |
|
| 59 |
```ts file="./PaginationOffset.tsx" |
| 60 |
|
| 61 |
``` |
| 62 |
|
| 63 |
### Sticky |
| 64 |
|
| 65 |
```ts isFullscreen file="./PaginationSticky.tsx" |
| 66 |
|
| 67 |
``` |
| 68 |
|
| 69 |
### Dynamic sticky top |
| 70 |
|
| 71 |
Pagination can be made sticky via two properties: `isStickyBase`, which allows separate control of the sticky position, and `isStickyStuck`, which applies the sticky styling. In this example, `isStickyStuck` is only applied when the pagination is not at the top of the scroll parent container. |
| 72 |
|
| 73 |
```ts isFullscreen file="./PaginationDynamicStickyTop.tsx" |
| 74 |
|
| 75 |
``` |
| 76 |
|
| 77 |
### Dynamic sticky bottom |
| 78 |
|
| 79 |
Bottom pagination can be made sticky via two properties: `isStickyBase`, which allows separate control of the sticky position, and `isStickyStuck`, which applies the sticky styling. In this example, `isStickyStuck` is only applied when the pagination is not at the bottom of the scroll parent container. |
| 80 |
|
| 81 |
```ts isFullscreen file="./PaginationDynamicStickyBottom.tsx" |
| 82 |
|
| 83 |
``` |
| 84 |
|
| 85 |
### Inset |
| 86 |
|
| 87 |
```ts file="./PaginationInset.tsx" |
| 88 |
|
| 89 |
``` |