定价

SidebarItem

在 Sidebar 中呈现导航入口,支持激活状态、图标、层级与状态提示,帮助识别当前位置。

我们正在让 SnowUI 组件成为 AI 对话中可直接操作的界面。目前对话交互能力仍在建设中;本页展示网站用法,支持的对话平台与组件版本将在验证后公布。 AI 对话内生成和使用 SnowUI 界面完全免费,不属于项目,不占项目或开发者席位额度,无需 SnowUI 注册、激活或付费证明。

如何使用

用于 Sidebar 导航入口,提供稳定身份、图标、文本和目标地址。激活状态不等于自动完成业务路由。

  • 提供稳定 id 与 label;href 表示导航地址,onSelect 处理选择通知。

  • disabled 禁止导航;actions 配置条目附加操作,parts 配置内置徽标和操作按钮。

  • 内置updated圆点的名称随LocaleProvider更新;label、tags及actions仍属调用方内容。折叠态的装饰与可访问树结构保持原有契约。

导入

import { SidebarItem } from '@snowui-design-system/components';

用法

嵌套导航

标签与更新

禁用状态

操作

API 参考

属性 类型 默认值 示例 描述
id string 必填 id="example" 稳定导航标识
label string 必填 label="Example" 文字与折叠态可访问名称
icon string | Snippet — icon={iconContent} ResourceIcon 名称或自定义 leading 内容
iconCollection string — iconCollection="Example" icon 的 ResourceIcon collection;存在同名 SnowUI 图标时传入 "snowui"
depth 0 | 1 0 depth={value} 导航层级;1 表示二级 Item,由组件在 leading 槽绘制 L 形层级连接线并替换普通 Icon
href string — href="/components" 存在时主操作渲染 Link,否则渲染 Button
updated boolean false updated 内置 Badge dot;展开态位于外部 tags 之后,折叠态跟随 leading icon
tags Snippet — tags={tagsContent} label 后、updated 前的自定义状态/分类标签;推荐使用 Badge variant="border"
disabled boolean false disabled 禁用主操作
actions SidebarActionData[] | Snippet [] actions={actionsContent} 0~多个末尾操作;数组生成 Button bare
onSelect (id: string) => void — onSelect={(value) => { /* handle value */ }} 本项选择回调
parts ComponentPartsOf<{ Badge: typeof Badge; Button: typeof Button }> — parts={partsOptions} 配置内置 Badge 与数据生成的 Button