Bar List
ラベル付きの横棒をランキング表示し、値を横に添えるリスト。最大値または合計に合わせて伸縮し、ラベルには任意のテンプレートを使えます。
Angular: 対応 Vue: 対応 React: 対応 React Native: 対応
使い方
<div class="demo-stack" style="max-width: 28rem; gap: var(--space-6)">
<sone-bar-list [items]="statuses" ariaLabel="Meetings by status">
<ng-template soneBarListLabel [soneBarListLabelOf]="statuses" let-row>
<span soneBadge [variant]="row.variant">{{ row.label }}</span>
</ng-template>
</sone-bar-list>
<sone-bar-list [items]="models" scale="total" [valueFormat]="tokens" ariaLabel="Tokens by model" />
</div>インポート
import {
SoneBarListComponent,
SoneBarListLabelDirective,
} from "@surface-one/angular/bar-list";API リファレンス
SoneBarListComponentコンポーネント
`<sone-bar-list>` — a ranked list of labelled horizontal bars with the value written next to each (Tremor's BarList). A real `<ul>`: every row reads as “label value”, the bar itself is decoration.
| 名前 | 型 | デフォルト |
|---|---|---|
itemsThe rows, drawn in the order given (sort them yourself for a ranking). | readonly T[] | [] |
scaleWhat a full bar means: the largest value (`max`) or the sum of all values (`total`). | SoneBarListScale | "max" |
maxA fixed full-bar value instead of the one `scale` computes (e.g. a quota). | number | null | undefined | undefined |
valueFormatFormats `value` when an item has no `valueLabel`; default: a localized number. | SoneBarListFormat | defaultFormat |
ariaLabelNames the list (“Tokens by model”). | string | null | null |
SoneBarListLabelDirectiveディレクティブ
`<ng-template soneBarListLabel let-item>` — renders each row's label instead of its text (a badge, an avatar, a link). `soneBarListLabelOf` only TYPES `let-item` when the items carry extra fields.
| 名前 | 型 | デフォルト |
|---|---|---|
soneBarListLabelOf | readonly T[] | null | undefined | undefined |