外观
Badge 徽标
用短标签标记记录的状态或类别,可通过变体区分草稿、已发布和失败。
import { SBadge } from '@icecreamqaq/shadcn/badge'使用示例
常用 API
| 成员 | 类型 | 用法 |
|---|---|---|
SBadge.variant | "default" | "secondary" | "destructive" | "outline" | 选择徽标的配色与边框,默认使用 default。 |
SBadge.asChild | boolean | 将徽标的属性与样式传给唯一子元素,例如作为标签链接的 a 元素。 |
badgeVariants() | variant → string | 按给定的变体返回徽标的命名空间类名。 |
完整 API
Badge5 个成员
属性
| 名称 | 类型 |
|---|---|
asChild | boolean |
as | AsTag | Component |
variant | "default" | "destructive" | "outline" | "secondary" | null |
class | ClassValue |
插槽
| 名称 | 类型 |
|---|---|
default | ((props: {}) => any) |
分组导出
模板标签为 <s-badge>。
组件 SBadge
函数与常量 badgeVariants
类型 BadgeVariants