- 分组
- 对照 · 行 × 列的标识
- 组件
Matrix·#matrix- 交互
- 悬停一行时整行变暗底;悬停单元格时标识反白。
适合
- “谁在哪一类里叫什么”:厂商 × 用途、平台 × 接口、版本 × 功能
- 格子里是短标识而不是句子
不适合
- 格子里要写句子:用 CompareTable 或拆页
- 只有新旧两列:用 CompareTable
内容上限
| 1 | columns 2–4 列:label ≤ 8 字,note ≤ 14 字 |
| 2 | rows 3–6 行:label ≤ 10 字,sub ≤ 16 个字符 |
| 3 | 单元格 ≤ 18 个字符,没有就写 null |
| 4 | focus 最多 1 列;footnote ≤ 60 字 |
| 5 | 标题写成一行时整页更从容;两行标题时最多 5 行数据 |
字段
| 字段 | 类型 | |
|---|---|---|
kicker · 必填 | string | 标题上方的小节名,2–8 字 |
title · 必填 | string | string[] | 页面标题;传数组可手动断行,每项一行 |
lead | string | 一到两句导语,≤ 60 字 |
source | string | 事实出处;页面上有任何数据或事实时必填 |
hint | ReactNode | 页眉中间的操作提示,可用 <kbd> |
columns · 必填 | { icon?, label, note? }[] | 列头 |
rows · 必填 | { label, sub?, cells: (string | null)[] }[] | cells 与 columns 一一对应 |
focus | number | 强调列的下标 |
footnote | string | 表格下方的注释 |
示例代码
<Matrix
kicker="AI 爬虫"
title="三类爬虫,三个独立的决定"
columns={[
{ icon: 'search', label: '搜索收录', note: '封了就从回答中消失' },
{ icon: 'user', label: '用户发起访问' },
{ icon: 'cpu', label: '模型训练', note: '不影响搜索收录' },
]}
rows={[
{ label: 'Orbit', sub: 'AskBot', cells: ['OB-SearchBot', 'AskBot-User', 'OrbitBot'] },
{ label: 'Pexo', cells: ['PexoBot', 'Pexo-User', null] },
]}
focus={0}
source="示例知识库 · 为 AI 爬虫配置 robots.txt"
/>