Stat
説明リストで示す主要な数値。ラベル・値・補足・トレンドを、カード、くぼんだタイル、またはシンプルな横並びで表示します。
Angular: 対応 Vue: 対応 React: 対応 React Native: 対応
使い方
- Meetings
- 128
- Since March
- Total time
- 41h 12m
- About 19 min each
- This week
- 9
- up 50%
- Cloud calls
- 56
- up 17%
- Meetings
- 128
- Total time
- 41h 12m
- This week
- 9
<div class="demo-stack" style="max-width: 48rem">
<dl soneStatGroup>
<div soneStat style="--i: 0">
<dt soneStatLabel>Meetings</dt>
<dd soneStatValue>128</dd>
<dd soneStatHint>Since March</dd>
</div>
<div soneStat style="--i: 1">
<dt soneStatLabel>Total time</dt>
<dd soneStatValue>41h 12m</dd>
<dd soneStatHint>About 19 min each</dd>
</div>
<div soneStat style="--i: 2">
<dt soneStatLabel>This week</dt>
<dd soneStatValue>9</dd>
<dd soneStatTrend [delta]="3">50%</dd>
</div>
<div soneStat style="--i: 3">
<dt soneStatLabel>Cloud calls</dt>
<dd soneStatValue>56</dd>
<!-- More cloud calls is bad news: force the tone -->
<dd soneStatTrend [delta]="8" tone="negative">17%</dd>
</div>
</dl>
<dl soneStatGroup layout="inline" separated aria-label="Your stats">
<div soneStat variant="plain" size="sm">
<dt soneStatLabel>Meetings</dt>
<dd soneStatValue>128</dd>
</div>
<div soneStat variant="plain" size="sm">
<dt soneStatLabel>Total time</dt>
<dd soneStatValue>41h 12m</dd>
</div>
<div soneStat variant="plain" size="sm">
<dt soneStatLabel>This week</dt>
<dd soneStatValue>9</dd>
</div>
</dl>
</div>インポート
import {
SoneStatDirective,
SoneStatGroupDirective,
SoneStatHintDirective,
SoneStatLabelDirective,
SoneStatTrendComponent,
SoneStatValueDirective,
} from "@surface-one/angular/stat";API リファレンス
SoneStatDirectiveディレクティブ
`div[soneStat]` — one figure: a `dt[soneStatLabel]`, a `dd[soneStatValue]` and optional `dd[soneStatHint]` / `dd[soneStatTrend]`. The DOM keeps `dt` first; `labelPosition="bottom"` only moves it visually. Set `--i` (`[style.--i]="$index"`) to stagger the entry animation.
| 名前 | 型 | デフォルト |
|---|---|---|
variant | SoneStatVariant | "card" |
size | SoneStatSize | "md" |
labelPositionWhere the label sits visually; the DOM order (dt before dd) never changes. | SoneStatLabelPosition | "top" |
align`center` centres the label, value and hint (a hero figure). | SoneStatAlign | "start" |
SoneStatGroupDirectiveディレクティブ
`dl[soneStatGroup]` — a row or grid of key figures. The `<dl>` keeps each label paired with its value for screen readers; every `[soneStat]` inside is a `<div>` that groups one `dt` with its `dd`s.
| 名前 | 型 | デフォルト |
|---|---|---|
layout`grid` fills the width in equal tracks; `inline` is a wrapping row of figures. | SoneStatGroupLayout | "grid" |
columnsA fixed number of grid columns; `null` (the default) auto-fits ~10rem tracks. | number | null | null |
separatedHairlines between the figures (a joined panel in `grid`, rules in `inline`). | boolean | false |
SoneStatHintDirectiveディレクティブ
`dd[soneStatHint]` — a quiet line of context under the value.
SoneStatLabelDirectiveディレクティブ
`dt[soneStatLabel]` — what the figure counts.
SoneStatTrendComponentコンポーネント
`dd[soneStatTrend]` — the change since the last period. `delta`'s sign picks the arrow and, with `tone="auto"`, the colour (up = positive); set `tone` when up is bad (costs, errors). The visible text is projected — write the magnitude (`12%`); screen readers hear the direction first ("up 12%").
| 名前 | 型 | デフォルト |
|---|---|---|
deltaThe change; its sign sets the arrow. `null` hides the arrow. | number | null | null |
tone | SoneStatTrendTone | "auto" |
upLabel | — | $localize`:Read before a figure that went up, e.g. "up 12%":up` |
downLabel | — | $localize`:Read before a figure that went down, e.g. "down 3%":down` |
flatLabel | — | $localize`:Read before a figure that did not change, e.g. "unchanged 0%":unchanged` |
SoneStatValueDirectiveディレクティブ
`dd[soneStatValue]` — the figure itself, in tabular monospaced numerals.