Badge
用于状态、计数或标签的紧凑标签,提供六种变体和四种状态色。
可用框架
Angular: 可用 Vue: 可用 React: 可用 React Native: 可用
用法
DefaultSecondaryOutlineGhostDestructive
RecordingTranscribedExportedPausedSyncing
312899+Local onlyInteractive
design roadmap
<div class="demo-stack">
<div class="demo-row" style="align-items: center">
<span soneBadge>Default</span>
<span soneBadge variant="secondary">Secondary</span>
<span soneBadge variant="outline">Outline</span>
<span soneBadge variant="ghost">Ghost</span>
<span soneBadge variant="destructive">Destructive</span>
</div>
<div class="demo-row" style="align-items: center">
<span soneBadge variant="live" dot>Recording</span>
<span soneBadge variant="accent" dot>Transcribed</span>
<span soneBadge variant="success" dot>Exported</span>
<span soneBadge variant="warning" dot>Paused</span>
<span soneBadge variant="info" dot>Syncing</span>
</div>
<div class="demo-row" style="align-items: center">
<span soneBadge variant="count">3</span>
<span soneBadge variant="count">128</span>
<span soneBadge variant="destructive">99+</span>
<button soneBadge variant="outline" type="button">Filter: Design</button>
<span soneBadge variant="dashed">Local only</span>
<span soneBadge variant="secondary" interactive>Interactive</span>
</div>
<div class="demo-row" style="align-items: center">
<span soneBadge variant="secondary">
design
<button soneBadgeRemove aria-label="Remove design"><sone-icon icon="close" /></button>
</span>
<span soneBadge variant="accent">
roadmap
<button soneBadgeRemove aria-label="Remove roadmap"><sone-icon icon="close" /></button>
</span>
</div>
</div>导入
import {
SoneBadgeDirective,
SoneBadgeRemoveDirective,
} from "@surface-one/angular/badge";API 参考
SoneBadgeDirective指令
| 名称 | 类型 | 默认值 |
|---|---|---|
variant | BadgeVariant | "default" |
dotA leading status dot in the badge's colour (the `<span class="badge-dot">` part, drawn for you). | boolean | false |
interactiveThe badge reacts to the pointer (hover fill, pointer cursor) like a link or button badge — for a badge whose clickable parent is not itself the badge. | boolean | false |
SoneBadgeRemoveDirective指令
`button[soneBadgeRemove]` — the remove button inside a removable badge (a tag chip). Put the glyph inside (`<sone-icon icon="close" />`) and name it by what it removes: `aria-label="Remove design"`. `type` defaults to `button`.