--- title: Pagination description: "`Pagination` is a component for managing the pagination and navigation of content." links: - style: https://github.com/yamada-ui/yamada-ui/tree/main/packages/react/src/components/pagination/pagination.style.ts - source: https://github.com/yamada-ui/yamada-ui/tree/main/packages/react/src/components/pagination - storybook: https://yamada-ui.github.io/yamada-ui?path=/story/components-pagination--basic --- ```tsx ``` ## Usage ```tsx import { Pagination } from "@yamada-ui/react" ``` ```tsx import { Pagination } from "@/components/ui" ``` ```tsx import { Pagination } from "@workspaces/ui" ``` ```tsx ``` ### Change Variant ```tsx {(variant, index) => ( )} ``` ### Change Size ```tsx {(size, index) => } ``` ### Change Color Scheme ```tsx {(colorScheme) => ( )} ``` ### Default Page Set the initial page with the `defaultPage` prop. ```tsx ``` ### Add Edge Control Buttons To add buttons to move to the first and last pages, set `withEdges` to `true`. ```tsx ``` ### Customize the Number of Siblings To change the number of pages displayed on the left and right of the current page, set `siblings` to a number. ```tsx ``` ### Customize the Number of Boundaries To change the number of pages displayed on the left and right edges, set `boundaries` to a number. ```tsx ``` ### Disable To disable the pagination, set `disabled` to `true`. ```tsx {(variant, index) => ( )} ``` ### Display Text ```tsx } /> } /> } /> } /> ``` ### Customize Control Buttons ```tsx , }} controlPrevProps={{ icon: , }} edgeEndProps={{ icon: , }} edgeStartProps={{ icon: , }} /> ``` ### Customize Text ```tsx preview client } /> {({ page, total }) => `全${total}ページ中${page}ページ目`} } /> ``` ### Control ```tsx const [page, onChange] = useState(1) return ``` ## Props ### Pagination.Root | Prop | Default | Type | Description | | ------------------ | -------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------- | | `as` | - | `As` | The HTML element to render. | | `asChild` | - | `boolean` | Merges its props onto its immediate child. | | `css` | - | `CSSObject \| CSSObject[]` | The CSS object. | | `colorScheme` | - | `"amber" \| "black" \| "blackAlpha" \| "blue" \| "cyan" \| "danger" \| "emerald" \| "error" \| "flashy" \| "fuchsia" ...` | Set color scheme variables. | | `size` | `"md"` | `"2xl" \| "lg" \| "md" \| "sm" \| "xl" \| "xs"` | The size of the component. | | `variant` | `"solid"` | `"outline" \| "solid" \| "subtle" \| "surface"` | The variant of the component. | | `total` | - | `number` | The total number of pages in pagination. | | `align` | - | `"-moz-initial" \| "baseline" \| "center" \| "end" \| "flex-end" \| "flex-start" \| "inherit" \| "initial" \| "normal" \| "revert-layer" ...` | The CSS `align-items` property. | | `attached` | `false` | `boolean` | If `true`, the borderRadius of button that are direct children will be altered to look flushed together. | | `basis` | - | `"-moz-fit-content" \| "-moz-initial" \| "-moz-max-content" \| "-moz-min-content" \| "-webkit-auto" \| "0.5" \| "1.5" \| "1" \| "1/12" \| "1/2" ...` | The CSS `flex-basis` property. | | `boundaries` | `1` | `number` | Number of elements visible on the left/right edges. | | `controlNextProps` | - | `PaginationItemProps` | Props for next of the control button element. | | `controlPrevProps` | - | `PaginationItemProps` | Props for previous of the control button element. | | `controlProps` | - | `PaginationItemProps` | Props for control button element. | | `defaultPage` | `1` | `number` | The initial page of the pagination. Should be less than `total` and greater than `1`. | | `direction` | - | `"-moz-initial" \| "column-reverse" \| "column" \| "inherit" \| "initial" \| "revert-layer" \| "revert" \| "row-reverse" \| "row" \| "unset" ...` | The CSS `flex-direction` property. | | `disabled` | `false` | `boolean` | If `true`, all wrapped button will be disabled. | | `edgeEndProps` | - | `PaginationItemProps` | Props for end of the edge button element. | | `edgeProps` | - | `PaginationItemProps` | Props for edge button element. | | `edgeStartProps` | - | `PaginationItemProps` | Props for start of the edge button element. | | `ellipsisProps` | - | `PaginationItemProps` | Props for ellipsis of the element. | | `fullRounded` | `false` | `boolean` | If `true`, the button is full rounded. Else, it'll be slightly round. | | `grow` | `false` | `boolean` | If `true`, the children will grow to fill the available space. | | `itemProps` | - | `PaginationItemProps` | Props for item of the button element. | | `justify` | - | `"-moz-initial" \| "center" \| "end" \| "flex-end" \| "flex-start" \| "inherit" \| "initial" \| "left" \| "normal" \| "revert-layer" ...` | The CSS `justify-content` property. | | `onChange` | - | `(page: number) => void` | The callback invoked when the page changes. | | `orientation` | `"horizontal"` | `"horizontal" \| "vertical"` | The orientation of the group. | | `page` | - | `number` | The page of the pagination. Should be less than `total` and greater than `1`. | | `shrink` | - | `"-moz-initial" \| "inherit" \| "initial" \| "revert-layer" \| "revert" \| "unset" \| number & {} ...` | The CSS `flex-shrink` property. | | `siblings` | `1` | `number` | Number of siblings displayed on the left/right side of selected page. | | `stacking` | - | `"first-on-top" \| "last-on-top"` | The stacking order of the group. | | `withControls` | `true` | `boolean` | If `true`, display the control buttons. | | `withEdges` | `false` | `boolean` | If `true`, display the edge buttons. | | `wrap` | - | `"-moz-initial" \| "inherit" \| "initial" \| "nowrap" \| "revert-layer" \| "revert" \| "unset" \| "wrap-reverse" \| "wrap" ...` | The CSS `flex-wrap` property. | ### Pagination.EndTrigger | Prop | Default | Type | Description | | ------------- | ------- | ------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------ | | `as` | - | `As` | The HTML element to render. | | `asChild` | - | `boolean` | Merges its props onto its immediate child. | | `css` | - | `CSSObject \| CSSObject[]` | The CSS object. | | `colorScheme` | - | `"amber" \| "black" \| "blackAlpha" \| "blue" \| "cyan" \| "danger" \| "emerald" \| "error" \| "flashy" \| "fuchsia" ...` | Set color scheme variables. | ### Pagination.Item | Prop | Default | Type | Description | | --------------- | ---------- | ------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------- | | `as` | - | `As` | The HTML element to render. | | `asChild` | - | `boolean` | Merges its props onto its immediate child. | | `css` | - | `CSSObject \| CSSObject[]` | The CSS object. | | `colorScheme` | - | `"amber" \| "black" \| "blackAlpha" \| "blue" \| "cyan" \| "danger" \| "emerald" \| "error" \| "flashy" \| "fuchsia" ...` | Set color scheme variables. | | `size` | - | `"2xl" \| "2xs" \| "lg" \| "md" \| "sm" \| "xl" \| "xs"` | The size of the component. | | `variant` | - | `"ghost" \| "outline" \| "solid" \| "subtle" \| "surface" ...` | The variant of the component. | | `active` | `false` | `boolean` | If `true`, the button is represented as active. | | `disabled` | `false` | `boolean` | If `true`, the button is disabled. | | `disableRipple` | `false` | `boolean` | If `true`, disable ripple effects when pressing a element. | | `fullRounded` | `false` | `boolean` | If `true`, the button is full rounded. Else, it'll be slightly round. | | `icon` | - | `ReactNode` | The icon to be used in the button. | | `loading` | `false` | `boolean` | If `true`, the loading state of the button is represented. | | `type` | `"button"` | `"button" \| "reset" \| "submit"` | The type of button. Accepts `button`, `reset`, or `submit`. | ### Pagination.Items | Prop | Default | Type | Description | | ---------- | ------- | --------------------------- | ------------------------------------------------------------------------------------------- | | `children` | - | `(page: Page) => ReactNode` | The function used to generate children. it will be called with page number or `"ellipsis"`. | | `render` | - | `(page: Page) => ReactNode` | The function used to generate children. it will be called with page number or `"ellipsis"`. | ### Pagination.NextTrigger | Prop | Default | Type | Description | | ------------- | ------- | ------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------ | | `as` | - | `As` | The HTML element to render. | | `asChild` | - | `boolean` | Merges its props onto its immediate child. | | `css` | - | `CSSObject \| CSSObject[]` | The CSS object. | | `colorScheme` | - | `"amber" \| "black" \| "blackAlpha" \| "blue" \| "cyan" \| "danger" \| "emerald" \| "error" \| "flashy" \| "fuchsia" ...` | Set color scheme variables. | ### Pagination.PrevTrigger | Prop | Default | Type | Description | | ------------- | ------- | ------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------ | | `as` | - | `As` | The HTML element to render. | | `asChild` | - | `boolean` | Merges its props onto its immediate child. | | `css` | - | `CSSObject \| CSSObject[]` | The CSS object. | | `colorScheme` | - | `"amber" \| "black" \| "blackAlpha" \| "blue" \| "cyan" \| "danger" \| "emerald" \| "error" \| "flashy" \| "fuchsia" ...` | Set color scheme variables. | ### Pagination.StartTrigger | Prop | Default | Type | Description | | ------------- | ------- | ------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------ | | `as` | - | `As` | The HTML element to render. | | `asChild` | - | `boolean` | Merges its props onto its immediate child. | | `css` | - | `CSSObject \| CSSObject[]` | The CSS object. | | `colorScheme` | - | `"amber" \| "black" \| "blackAlpha" \| "blue" \| "cyan" \| "danger" \| "emerald" \| "error" \| "flashy" \| "fuchsia" ...` | Set color scheme variables. | ### Pagination.Text | Prop | Default | Type | Description | | ------------- | ----------- | ------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------ | | `as` | - | `As` | The HTML element to render. | | `asChild` | - | `boolean` | Merges its props onto its immediate child. | | `css` | - | `CSSObject \| CSSObject[]` | The CSS object. | | `colorScheme` | - | `"amber" \| "black" \| "blackAlpha" \| "blue" \| "cyan" \| "danger" \| "emerald" \| "error" \| "flashy" \| "fuchsia" ...` | Set color scheme variables. | | `children` | - | `ReactNodeOrFunction<{ page: number; total: number }>` | The children of the text. if function, it will be called with `{ page: number; total: number }`. | | `format` | `"compact"` | `"compact" \| "short"` | The format of the text. | ## Accessibility Currently, this section is being updated due to the migration of v2.