Component

Pagination

安装 Installation

npx timkit add pagination --yes --framework react

用法 Usage

import { Pagination } from "@/components/ui/pagination"

className 与 variant、size 可以一起用。字段以 timkit agent inspect pagination --json 的 props 为准。

示例

Examples

一次看一个示例。左侧按名称筛选,预览里可切换源码和框架。

12 / 12

Pagination · Disabled State · 01

Loading preview...

结构化 API

Structured API

与 UCS schema 对齐的 props、逻辑机与多框架运行时。

Component

pagination

Logic

zag / pagination

Runtime Frameworks

ReactVueWeappHTML

Supported Platforms

WebWeChat Mini Program

Configuration

PropTypeDefaultDescription
logic.provider*
enum (zag | native | none)
zagState and interaction provider used by this component.
logic.machine
string
paginationUnderlying state machine identifier when provider is zag.
platforms*
array
Web, WeChat Mini ProgramPlatforms officially supported by this schema.
frameworks*
array
React, Vue, Weapp, HTMLFramework demos/code currently available in registry files.
dependencies
array
@timui/core, @zag-js/reactRuntime package dependencies required by this registry item.
optionalPeerDependencies
array
lucide-reactOptional peer dependencies used by this registry item.
registryDependencies
array
buttonDependent Timkit registry components/hook entries.

Props

PropTypeDefaultDescription
disabled
boolean
falseWhen true, page changes are ignored.
page
number
1The current active page in controlled mode.
defaultPage
number
1The initial page used in uncontrolled mode.
count
number
-Total number of items used to calculate page count.
pageSize
number
10Number of items rendered per page.
siblingCount
number
1Number of sibling pages shown around the active page.

Events

PropTypeDefaultDescription
onPageChange
event
-Callback fired when the active page changes.
onPageSizeChange
event
-Callback fired when page size changes.

Slots

PropTypeDefaultDescription
default
slot
-The pagination segments

Parts

PropTypeDefaultDescription
root*
root
-The pagination container
content
part
-The parent of items
item
part
-A single item wrapper
link
part
-A link to a page
previous
part
-The previous page button
next
part
-The next page button
ellipsis
part
-The ellipsis indicator
This API reference is generated from `/packages/core` component schemas to keep React/Vue/Weapp docs consistent.

该组件尚无扩展说明文档。

键盘与焦点

Keyboard

跨 React、Vue 与小程序共享的交互与可读名称约定。

  • Enter or Space activates the previous page, next page, and page buttons.
  • A disabled control ignores those keys.
  • A page control that cannot move is not in the tab order.
  • A disabled pagination leaves every control out of the tab order.
  • When the item count is set, the page status reads the current page and the page count.
  • An omitted name is pagination.
  • A passed aria-label names the navigation.
  • On the mini program, each page number sits in a list item.
  • The ellipsis is hidden from the name.
  • In static HTML, that gap is hidden too.
  • On React and Vue, the arrows beside Previous and Next are hidden from the name.
  • In static HTML, page 1 is the current page.
  • Previous cannot move and is not a tab stop.
  • The current page uses aria-current page.
  • An inactive page link does not set aria-current.
  • On the mini program, a disabled pagination sets aria-disabled.

行为契约

Contract

props、默认值和运行时状态。

  • siblingCount is the number of pages kept on each side of the current page.
  • The default is 1.
  • A later page size or item count rebuilds the page list.