Source List
タイトル付きのソース一覧。チップまたは行で表示し、「もっと見る」の切り替えを備えます。重ねたマークと件数を表示する 1 つのチップにまとめ、そこから一覧を開くこともできます。
対応フレームワーク
Angular: 対応 Vue: 対応 React: 対応 React Native: 未対応
使い方
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>インポート
import {
SoneSourceListComponent,
SoneSourceListItemDirective,
SoneSourceListTriggerComponent,
} from "@surface-one/angular/source-list";API リファレンス
SoneSourceListComponentコンポーネント
| 名前 | 型 | デフォルト |
|---|---|---|
items | readonly T[] | [] |
trackBy必須 | (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 |
SoneSourceListItemDirectiveディレクティブ
| 名前 | 型 | デフォルト |
|---|---|---|
soneSourceListItemOf | readonly T[] | null | undefined | undefined |
SoneSourceListTriggerComponentコンポーネント
`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.
| 名前 | 型 | デフォルト |
|---|---|---|
countHow many sources there are (the count on the chip). | number | 0 |