Source List
Un elenco di fonti con titolo, sotto forma di chip o righe, con un pulsante per mostrarne di più. Oppure raccolte in un solo chip con marchi sovrapposti e un conteggio che apre l'elenco.
Disponibile in
Angular: disponibile Vue: disponibile React: disponibile React Native: non ancora disponibile
Utilizzo
Sources
Harbour Lane kickoff · Mar 3Pricing review · Mar 5Team retro · Mar 9
Sources5
- Harbour Lane kickoffMar 3
- Pricing reviewMar 5
- Team retroMar 9
<div class="demo-stack" style="max-width: 32rem">
<sone-source-list variant="chip" label="Sources" [items]="sources" [trackBy]="byId" [limit]="3">
<ng-template soneSourceListItem [soneSourceListItemOf]="sources" let-s>
<span soneItem variant="outline" size="xs">{{ s.title }} · {{ s.date }}</span>
</ng-template>
</sone-source-list>
<sone-source-list variant="row" size="sm" label="Sources" showCount [items]="sources" [trackBy]="byId" [limit]="3">
<ng-template soneSourceListItem [soneSourceListItemOf]="sources" let-s>
<div soneItem variant="muted" size="xs">
<div soneItemContent>
<span soneItemTitle>{{ s.title }}</span>
<span soneItemDescription>{{ s.date }}</span>
</div>
</div>
</ng-template>
</sone-source-list>
<div>
<button soneSourceListTrigger [count]="sources.length" [attr.aria-expanded]="open()"
[attr.aria-controls]="open() ? 'answer-sources' : null" (click)="open.set(!open())">
<sone-mark icon="meetings" tone="lagoon" size="sm" />
<sone-mark icon="notes" tone="iris" size="sm" />
<sone-mark icon="tasks" tone="amber" size="sm" />
</button>
</div>
@if (open()) {
<sone-source-list id="answer-sources" variant="row" size="sm" ariaLabel="Sources" [items]="sources" [trackBy]="byId">
<ng-template soneSourceListItem [soneSourceListItemOf]="sources" let-s>
<span soneItem variant="muted" size="xs">{{ s.title }} · {{ s.date }}</span>
</ng-template>
</sone-source-list>
}
</div>Importazione
import {
SoneSourceListComponent,
SoneSourceListItemDirective,
SoneSourceListTriggerComponent,
} from "@surface-one/angular/source-list";Riferimento API
SoneSourceListComponentComponente
| Nome | Tipo | Predefinito |
|---|---|---|
items | readonly T[] | [] |
trackByobbligatorio | (item: T) => string | — |
variant | SourceListVariant | "row" |
size | SourceListSize | "default" |
label | string | "" |
ariaLabel | string | null | null |
showCount | boolean | false |
limit | number | null | null |
columns | 1 | 2 | 1 |
list | boolean | null | null |
SoneSourceListItemDirectiveDirettiva
| Nome | Tipo | Predefinito |
|---|---|---|
soneSourceListItemOf | readonly T[] | null | undefined | undefined |
SoneSourceListTriggerComponentComponente
`button[soneSourceListTrigger]` — the sources behind an answer folded into one small chip: up to three stacked marks (projected: favicons, `<sone-avatar>`s, marks) and a count (“6 sources”). It is a plain button: open the full `<sone-source-list>` from it (a popover, a sheet or a disclosure) and wire `aria-expanded` / `aria-controls` for what it opens.
| Nome | Tipo | Predefinito |
|---|---|---|
countHow many sources there are (the count on the chip). | number | 0 |