Skip to content

Metric

The metric widget is a larger statistics widget that displays a title, label, value, and an optional trend indicator. The default slot can be used to embed additional content such as a chart.

Monthly revenue
Total earned this month
€ 48,290
vs. last month
Active users
Unique visitors
9,841
vs. last month

Props

title: string
The title of the metric widget.

value?: string | number
The primary value displayed in the metric widget.

change?: FluxStatisticsChange
An optional change indicator shown in the footer area.

footer?: string
An optional footer text shown below the change indicator.

icon?: FluxIconName
An icon shown in the header of the widget.

label?: string
A secondary label shown above the value.

Slots

default
Custom content rendered in the body of the widget, below the value.

Examples

With a breakdown

A metric widget using the default slot to display a breakdown of values.

Monthly revenue
Total earned this month
€ 48,290
Products€ 31,800Services€ 16,490
vs. last month

<template>
    <FluxStatisticsMetric
        style="min-width: 100%; max-width: 360px"
        icon="chart-line"
        title="Monthly revenue"
        label="Total earned this month"
        value="€ 48,290"
        footer="vs. last month"
        :change="{color: 'success', icon: 'arrow-trend-up', value: '+12.7%'}">
        <small>Products</small>
        <span>€ 31,800</span>
        <small>Services</small>
        <span>€ 16,490</span>
    </FluxStatisticsMetric>
</template>

<script
    setup
    lang="ts">
    import { FluxStatisticsMetric } from '@flux-ui/statistics';
</script>

Used components