UI components · Composed · new in 0.7
SpStatistic
A small-caps title, a large tabular figure, prefix and suffix, and a trend arrow. Group: Composed · new in silverpoint 0.7, in React, Vue, Angular and Reflex (sp_statistic).
Live
Drawn here with the Reflex version, sp_statistic, on the ground you pick:
Code
The same example in each framework; pick one once and every example on the site follows it.
import { SpStatistic } from '@silverpoint/react/ui/statistic';
<SpStatistic title="Revenue" value="48.2" prefix="$" suffix="k" trend="up" delta="+8.2 %" />
<SpStatistic title="Churn" value="2.1" suffix="%" trend="down" delta="−0.4 %" /><script setup lang="ts">
import { SpStatistic } from '@silverpoint/vue/ui/statistic';
</script>
<template>
<SpStatistic title="Revenue" value="48.2" prefix="$" suffix="k" trend="up" delta="+8.2 %" />
<SpStatistic title="Churn" value="2.1" suffix="%" trend="down" delta="−0.4 %" />
</template>import { Component } from '@angular/core';
import { SpStatistic } from '@silverpoint/angular/ui/statistic';
@Component({
selector: 'app-figures',
imports: [SpStatistic],
template: `
<sp-statistic title="Revenue" value="48.2" prefix="$" suffix="k" trend="up" delta="+8.2 %" />
<sp-statistic title="Churn" value="2.1" suffix="%" trend="down" delta="−0.4 %" />
`,
})
export class Figures {}sp_statistic("Revenue", "48.2", prefix="$", suffix="k", trend="up", delta="+8.2 %")
sp_statistic("Churn", "2.1", suffix="%", trend="down", delta="−0.4 %")Import
Import @silverpoint/grounds/ui.css once, beside styles.css; Reflex adds it for you. Every adapter also exports it from the ui barrel.
| Framework | Import |
|---|---|
| React | import { SpStatistic } from '@silverpoint/react/ui/statistic'; |
| Vue | import { SpStatistic } from '@silverpoint/vue/ui/statistic'; |
| Angular | import { SpStatistic } from '@silverpoint/angular/ui/statistic'; · sp-statistic |
| Reflex | from reflex_silverpoint_react import sp_statistic |
Props
| React / Angular | Vue | Type | Description |
|---|---|---|---|
title required | title | string | The label above the value. |
value required | value | string | number | Printed as given. |
prefix | prefix | string | Printed before the value ($). |
suffix | suffix | string | Printed after the value (%). |
trend | trend | 'up' | 'down' | Draws the exact ↑ or ↓ glyph beside the delta. |
delta | delta | string | The change, as text (+4.2%). |
In Reflex the names are snake_case; the Reflex column of Composed components shows the builder's arguments.
Common props
Every UI component also takes these, falling back to the dashboard it sits in, then to the provider. In Reflex they read silverpoint_provider too; only sp_trigger does not: pass them to it.
| React / Angular | Vue | Reflex | Type | Description |
|---|---|---|---|---|
id | id | id | str | The frame variant and every related id derive from it. |
ground | ground | ground | Literal['silverpoint', 'cyanotype'] | str | dict[str, Any] | Style ground: "silverpoint" or "cyanotype", or a ground object. Defaults to the dashboard's, then the provider's, or silverpoint. |
substrate | substrate | substrate | Literal['cream', 'green', 'blue', 'ochre', 'prussian'] | Prepared substrate within the ground. |
mode | mode | mode | Literal['ink', 'precision'] | ink by default; precision disables inking. |
seed | seed | seed | str | int | Seed of the frame's hand; overrides id for the frame variant only. |
size | size | size | Literal['sm', 'md', 'lg'] | Control size: sm, md (default) or lg. |
palette | palette | palette | dict[str, str] | Colours over the ground's (set with palette=), merged over the dashboard's and the provider's. |
className | class-name | class_name | str | Added to the component's root element, after its own classes. |
palette | palette | palette | Palette | Colours over the ground's, merged over the dashboard's and the provider's. |
Report it
Found something wrong with SpStatistic? Open an issue on GitHub — the form comes pre-filled with the component and the version.