Pagination
Pagination
is a component for managing the pagination and navigation of content.
<Pagination.Root total={10} />
Usage
import { Pagination } from "@yamada-ui/react"
import { Pagination } from "@/components/ui"
import { Pagination } from "@workspaces/ui"
<Pagination.Root total={10} />
Change Variant
<VStack>
<For each={["solid", "outline", "ghost", "unstyled"]}>
{(variant, index) => (
<Pagination.Root key={index} total={10} variant={variant} />
)}
</For>
</VStack>
Change Size
<VStack>
<For each={["xs", "sm", "md", "lg", "xl"]}>
{(size, index) => <Pagination.Root key={index} total={10} size={size} />}
</For>
</VStack>
Change Color Scheme
<VStack>
<For each={["success", "warning"]}>
{(colorScheme) => (
<Pagination.Root key={colorScheme} colorScheme={colorScheme} total={10} />
)}
</For>
</VStack>
Default Page
Set the initial page with the defaultPage
prop.
<Pagination.Root defaultPage={5} total={10} />
Add Edge Control Buttons
To add buttons to move to the first and last pages, set withEdges
to true
.
<Pagination.Root total={20} withEdges />
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.
<Pagination.Root total={77} siblings={3} />
Customize the Number of Boundaries
To change the number of pages displayed on the left and right edges, set boundaries
to a number.
<Pagination.Root total={77} boundaries={3} />
Disable
To disable the pagination, set disabled
to true
.
<VStack>
<For each={["solid", "outline", "ghost", "unstyled"]}>
{(variant, index) => (
<Pagination.Root key={index} total={10} variant={variant} disabled />
)}
</For>
</VStack>
Display Text
<VStack>
<Pagination.Root size="md" gap="md" total={10}>
<Pagination.PrevTrigger>
<Pagination.Item icon={<ChevronLeftIcon />} />
</Pagination.PrevTrigger>
<Pagination.Text format="compact" />
<Pagination.NextTrigger>
<Pagination.Item icon={<ChevronRightIcon />} />
</Pagination.NextTrigger>
</Pagination.Root>
<Pagination.Root size="md" gap="md" total={10}>
<Pagination.PrevTrigger>
<Pagination.Item icon={<ChevronLeftIcon />} />
</Pagination.PrevTrigger>
<Pagination.Text format="short" />
<Pagination.NextTrigger>
<Pagination.Item icon={<ChevronRightIcon />} />
</Pagination.NextTrigger>
</Pagination.Root>
</VStack>
Customize Control Buttons
<Pagination.Root
total={10}
withEdges
controlNextProps={{
icon: <ArrowRightIcon />,
}}
controlPrevProps={{
icon: <ArrowLeftIcon />,
}}
edgeEndProps={{
icon: <ArrowRightToLineIcon />,
}}
edgeStartProps={{
icon: <ArrowLeftToLineIcon />,
}}
/>
Customize Text
<Pagination.Root size="md" gap="md" total={20}>
<Pagination.PrevTrigger>
<Pagination.Item icon={<ChevronLeftIcon />} />
</Pagination.PrevTrigger>
<Pagination.Text>
{({ page, total }) => `全${total}ページ中${page}ページ目`}
</Pagination.Text>
<Pagination.NextTrigger>
<Pagination.Item icon={<ChevronRightIcon />} />
</Pagination.NextTrigger>
</Pagination.Root>
"use client"
to the top of the file.Control
const [page, onChange] = useState<number>(1)
return <Pagination.Root page={page} total={10} onChange={onChange} />
"use client"
to the top of the file.Props
Accessibility
Currently, this section is being updated due to the migration of v2.