Bar List
Uma lista ordenada de barras horizontais com rótulo e o valor ao lado, escaladas pelo maior valor ou pelo total; o rótulo aceita qualquer template.
Angular: disponível Vue: disponível React: disponível React Native: disponível
Uso
<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>Importação
import {
SoneBarListComponent,
SoneBarListLabelDirective,
} from "@surface-one/angular/bar-list";Referência da API
SoneBarListComponentComponente
`<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.
| Nome | Tipo | Padrão |
|---|---|---|
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 |
SoneBarListLabelDirectiveDiretiva
`<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.
| Nome | Tipo | Padrão |
|---|---|---|
soneBarListLabelOf | readonly T[] | null | undefined | undefined |