Statistic
Statistic is used to show numbers and data in a box.
Last Year: 27.7M
-2.0M (-7%)
<script lang="ts">
import { Statistic } from 'stwui';
import { formatNumber } from 'stwui/utils';
const favorite = "svg-path";
</script>
<Statistic>
<Statistic.Icon slot="icon" data={favorite} />
<Statistic.Title slot="title">Total Likes</Statistic.Title>
<Statistic.Value slot="value">
{formatNumber(25660000, {
style: 'decimal',
notation: 'compact',
maximumFractionDigits: 1,
minimumFractionDigits: 1
})}
</Statistic.Value>
<Statistic.Comparison slot="comparison">
<Statistic.Comparison.Value slot="value">
Last Year: {formatNumber(27660000, {
style: 'decimal',
notation: 'compact',
maximumFractionDigits: 1,
minimumFractionDigits: 1
})}
</Statistic.Comparison.Value>
<Statistic.Comparison.Trend slot="trend" trend="down">
{formatNumber(-2000000, {
style: 'decimal',
notation: 'compact',
maximumFractionDigits: 1,
minimumFractionDigits: 1
})} ({formatNumber(-0.0723, {
style: 'percent'
})})
</Statistic.Comparison.Trend>
</Statistic.Comparison>
</Statistic>
Last Year: $2.6M
$80.0K (3%)
<script lang="ts">
import { Statistic } from 'stwui';
import { formatNumber } from 'stwui/utils';
const chart_box = "svg-path";
const home = "svg-path";
</script>
<Statistic>
<Statistic.Icon slot="icon" data={chart_box} />
<Statistic.Title slot="title">Page Views</Statistic.Title>
<Statistic.Value slot="value">
{formatNumber(2660000, {
style: 'currency',
notation: 'compact',
maximumFractionDigits: 1,
minimumFractionDigits: 1
})}
</Statistic.Value>
<Statistic.Comparison slot="comparison">
<Statistic.Comparison.Value slot="value">
Last Year: {formatNumber(2580000, {
style: 'currency',
notation: 'compact',
maximumFractionDigits: 1,
minimumFractionDigits: 1
})}
</Statistic.Comparison.Value>
<Statistic.Comparison.Trend trend="up" slot="trend">
<Statistic.Comparison.Trend.Icon slot="icon" data={home} />
{formatNumber(80000, {
style: 'currency',
notation: 'compact',
maximumFractionDigits: 1,
minimumFractionDigits: 1
})} ({formatNumber(0.031, {
style: 'percent'
})})
</Statistic.Comparison.Trend>
</Statistic.Comparison>
</Statistic>
<script lang="ts">
import { Statistic } from 'stwui';
import { formatNumber } from 'stwui/utils';
const chart_box = "svg-path";
</script>
<Statistic>
<Statistic.Icon slot="icon" data={chart_box} />
<Statistic.Title slot="title">New Users</Statistic.Title>
<Statistic.Value slot="value">
{formatNumber(82001, {
style: 'decimal',
notation: 'compact',
maximumFractionDigits: 1,
minimumFractionDigits: 1
})}
</Statistic.Value>
<Statistic.Goal progress={82.001} />
</Statistic>
<script lang="ts">
import { Statistic } from 'stwui';
import { formatNumber } from 'stwui/utils';
const favorite = "svg-path";
</script>
<Statistic>
<Statistic.Icon class="text-primary" slot="icon" data={favorite} />
<Statistic.Title slot="title">Total Likes</Statistic.Title>
<Statistic.Value class="text-primary" slot="value">
{formatNumber(25660000, {
style: 'decimal',
notation: 'compact',
maximumFractionDigits: 1,
minimumFractionDigits: 1
})}
</Statistic.Value>
</Statistic>
Last Year: $2.6M
<script lang="ts">
import { Statistic } from 'stwui';
import { formatNumber } from 'stwui/utils';
const chart_box = "svg-path";
</script>
<Statistic class="bg-gradient-to-r from-cyan-500 to-blue-500">
<Statistic.Icon class="text-white" slot="icon" data={chart_box} />
<Statistic.Title class="text-white" slot="title">Page Views</Statistic.Title>
<Statistic.Value class="text-white" slot="value">
{formatNumber(2660000, {
style: 'currency',
notation: 'compact',
maximumFractionDigits: 1,
minimumFractionDigits: 1
})}
</Statistic.Value>
<Statistic.Comparison slot="comparison">
<Statistic.Comparison.Value class="text-white" slot="value">
Last Year: {formatNumber(2580000, {
style: 'currency',
notation: 'compact',
maximumFractionDigits: 1,
minimumFractionDigits: 1
})}
</Statistic.Comparison.Value>
<Statistic.Comparison.Trend class="bg-white text-white" showIcon={false} slot="trend">
{formatNumber(80000, {
style: 'currency',
notation: 'compact',
maximumFractionDigits: 1,
minimumFractionDigits: 1
})} ({formatNumber(0.031, {
style: 'percent'
})})
</Statistic.Comparison.Trend>
</Statistic.Comparison>
</Statistic>
<script lang="ts">
import { Statistic } from 'stwui';
import { formatNumber } from 'stwui/utils';
</script>
<Statistic>
<Statistic.Title slot="title">New Users</Statistic.Title>
<Statistic.Value slot="value">
{formatNumber(82001, {
style: 'decimal',
notation: 'compact',
maximumFractionDigits: 1,
minimumFractionDigits: 1
})}
</Statistic.Value>
<Statistic.Goal progress={82.001} />
</Statistic>
Statistic Slots
title | <Statistic.Title slot="title" /> |
icon | <Statistic.Icon slot="icon" /> |
value | <Statistic.Value slot="value" /> |
default | |
comparison | <Statistic.Comparison slot="comparison" /> |
goal | <Statistic.Goal slot="goal" /> |
Statistic.Title Slots
default |
Statistic.Icon Props
data | string (IconData) | |
viewBox | string | 0 0 24 24 |
size | string | 38px |
width | string | 38px |
height | string | 38px |
color | string | currentColor |
stroke | string | undefined | |
fill | string | currentColor |
Statistic.Value Slots
default |
Statistic.Comparison Slots
value | <Statistic.Comparison.Value slot="value" /> |
trend | <Statistic.Comparison.Trend slot="trend" /> |
Statistic.Comparison.Value Slots
default |
Statistic.Comparison.Trend Props
trend | 'up' | 'down' | 'neutral' | undefined | |
showIcon | boolean | true |
Statistic.Comparison.Trend.Slots Slots
icon | <Statistic.Comparison.Trend.Icon slot="icon" /> |
default |
Statistic.Comparison.Trend.Icon Props
data | string (IconData) | |
viewBox | string | 0 0 24 24 |
size | string | 16px |
width | string | 16px |
height | string | 16px |
color | string | currentColor |
stroke | string | undefined | |
fill | string | currentColor |
Statistic.Goal Props
progress | number |