kitseed.
组件

Collection 内容集合

卡片与列表共享信息语义,展示方式由使用场景决定。

ContentRow 便于快速扫描,ContentCard 更适合预览图和较多说明;ViewSwitcher 切换本地展示值,LoadMore 管理分页操作的呈现。它们不获取数据或依赖 Subtic 的 Entry 模型。

安装

pnpm dlx shadcn@4.22.1 add http://127.0.0.1:3040/r/v0.3.0/collection.json

首次使用请先完成 Registry 与主题接入。

组合与状态

主链接和辅助 actions 是兄弟节点,避免嵌套交互元素。selected 仅表示视觉选中,不自动实现多选。分页状态由应用明确给出,加载失败保留已有内容并显示重试。

Props

API / 属性类型默认值说明
Row / Card titleReactNode必填主要内容
description / eyebrow / actionsReactNode—说明、分类和辅助操作
href / onOpen链接 / 回调—有 href 优先渲染链接
selected / disabledbooleanfalse视觉选中 / 禁用主操作与辅助操作
renderLink(props: ComponentProps<"a"> & { href: string }) => ReactNode原生 a接入框架链接并合并传入属性
Row leading / metaReactNode—图标或头像、辅助信息
Card media / footerReactNode—图片区域和底部信息
ViewSwitcher.value / onValueChange字符串 / 回调必填受控展示值
ViewSwitcher.options / label选项数组 / 名称必填{ value, label, icon? }
LoadMore.stateidle / loading / error / end必填分页状态
LoadMore.onLoad() => void必填加载或重试
LoadMore.labels / error文案 map / ReactNode中文文案 / —可覆盖每个状态

LoadMore 默认文案为“加载更多”“正在加载…”“已经全部看完了”,错误动作使用 Provider 的“重试”。ViewSwitcher 支持 disabled=false;Row/Card 支持 className。完整示例见内容集合模式。

键盘与约束

有 href 时提供原生链接行为,有 onOpen 时使用按钮,无操作时保持静态内容。ViewSwitcher 使用原生 radio,支持方向键。调用方需要处理分页并发、响应顺序和去重。

避免这样使用

不要在 title、description 或 media 中再放链接或按钮,交互应进入 actions / footer;不要只切换视觉但丢失搜索与选择状态;不要把读取失败伪装成“已加载全部”。

来源与版本

0.1.0,来自 Subtic apps/web/components/collection-layout.tsx、collection-list-row.tsx、collection-card-frame.tsx、collection-pagination.tsx。保留呈现,数据请求和领域动作留在应用。

查看由当前源码生成的类型参考

只展示 Kitseed 自身定义的属性,原生 HTML 与 Base UI 透传属性请参阅对应上游说明。

ContentRow

属性类型默认值
titleReactNode—
description?ReactNode—
href?string—
onOpen?() => void—
selected?booleanfalse
disabled?booleanfalse
renderLink?(props: ComponentProps<"a"> & { href: string }) => ReactNode—
actions?ReactNode—
className?string—
leading?ReactNode—
meta?ReactNode—
eyebrow?ReactNode—

ContentCard

属性类型默认值
titleReactNode—
description?ReactNode—
href?string—
onOpen?() => void—
selected?booleanfalse
disabled?booleanfalse
renderLink?(props: ComponentProps<"a"> & { href: string }) => ReactNode—
actions?ReactNode—
className?string—
media?ReactNode—
eyebrow?ReactNode—
footer?ReactNode—

ViewSwitcher

属性类型默认值
valuestring—
onValueChange(value: string) => void—
optionsreadonly ViewOption[]—
labelstring—
disabled?booleanfalse
className?string—

LoadMore

属性类型默认值
stateLoadMoreState—
onLoad() => void—
labels?Partial<{ idle: string; loading: string; error: string; end: string }>—
error?ReactNode—

本页内容