PageControls
- 组件说明:点状分页指示器,用于轮播、引导页等场景,指示当前页码位置。
- Dot 尺寸:16×4px 矩形,选中态使用
Grays/Black,未选中态使用Grays/Gray-4。 - 实现约定:纯 design 层组件,无
ui/primitive,样式集中在styles.ts管理。 - Figma 规范
基础用法
结果
Loading...
实时编辑器
function Demo() { const [current, setCurrent] = React.useState(0) return <PageControls total={4} current={current} onChange={setCurrent} /> }
不同数量
支持 2-8 个 dot。
结果
Loading...
实时编辑器
<div style={{ display: 'flex', flexDirection: 'column', gap: 16 }}> <div> <span style={{ fontSize: 12, color: '#999', marginBottom: 4, display: 'block' }}>2 pages</span> <PageControls total={2} current={0} /> </div> <div> <span style={{ fontSize: 12, color: '#999', marginBottom: 4, display: 'block' }}>4 pages</span> <PageControls total={4} current={1} /> </div> <div> <span style={{ fontSize: 12, color: '#999', marginBottom: 4, display: 'block' }}>8 pages</span> <PageControls total={8} current={3} /> </div> </div>
Token
| 状态 | Dot 颜色 |
|---|---|
| 选中 | Grays/Black#000000 |
| 未选中 | Grays/Gray-4#ADADAD |
Props
| 属性 | 类型 | 默认值 | 说明 |
|---|---|---|---|
total | number | — | 总页数(2-8) |
current | number | 0 | 当前选中页索引(从 0 开始) |
onChange | (index: number) => void | — | 页码变更回调 |
className | string | — | 自定义样式类 |