- Prop
label- Type
string- Default
- —
- Requirement
- required
MetricCard
React example follows below.
Vue example follows below.
Angular example follows below.
Svelte example follows below.
Solid example follows below.
- surface
- —
- marks
- —
- size
- —
- value
- —
ts
import { MetricCard } from "@grassroot/charts-react"; export default function MetricCardDemo() { return ( <div> <MetricCard animation={{ durationMs: 560 }} label="Checkout conversion" value={4.82} unit="%" goodDirection="up" color="var(--vs-success)" paused /> </div> );}- surface
- —
- marks
- —
- size
- —
- value
- —
ts
<script setup lang="ts">import { MetricCard } from "@grassroot/charts-vue";</script> <template> <div> <MetricCard :animation="{ durationMs: 560 }" label="Checkout conversion" :value="4.82" unit="%" goodDirection="up" color="var(--vs-success)" paused /> </div></template>- surface
- —
- marks
- —
- size
- —
- value
- —
ts
import { ChangeDetectionStrategy, Component } from "@angular/core";import { GrassrootMetricCard } from "@grassroot/charts-angular"; @Component({ selector: "app-metric-card-chart-demo", standalone: true, imports: [GrassrootMetricCard], changeDetection: ChangeDetectionStrategy.OnPush, host: { style: "display:block" }, template: `<div> <grassroot-metric-card style="display:contents" [animation]="{ durationMs: 560 }" label="Checkout conversion" [value]="4.82" unit="%" goodDirection="up" color="var(--vs-success)" [paused]="true" /> </div>`,})export class MetricCardDemoComponent {} export default MetricCardDemoComponent;- surface
- —
- marks
- —
- size
- —
- value
- —
ts
<script lang="ts"> import { MetricCard } from "@grassroot/charts-svelte";</script> <div> <MetricCard animation={{ durationMs: 560 }} label="Checkout conversion" value={4.82} unit="%" goodDirection="up" color="var(--vs-success)" paused /></div>- surface
- —
- marks
- —
- size
- —
- value
- —
ts
/** @jsxImportSource solid-js */import { MetricCard } from "@grassroot/charts-solid"; export default function MetricCardDemo() { return ( <div> <MetricCard animation={{ durationMs: 560 }} label="Checkout conversion" value={4.82} unit="%" goodDirection="up" color="var(--vs-success)" paused /> </div> );}Installation
API Reference
Import
import { MetricCard } from "@grassroot/charts-react";
Props
Prop
Type
Default
Requirement
labelstring—
required
valuenumber—
required
unitstring | undefined—
optional
colorstring | undefined—
optional
goodDirection"up" | "down" | undefined—
optional
format((value: number) => string) | undefined—
optional
sample((previous: number) => number) | undefined—
optional
pointsnumber | undefined—
optional
intervalMsnumber | undefined—
optional
pausedboolean | undefined—
optional
rendererChartRenderer | undefined—
optional
classNamestring | undefined—
optional
themeimport("@grassroot/theme").PartialChartTheme | undefined—
optional
animationimport("@grassroot/theme").ChartAnimationInput | undefined—
optional
- Prop
value- Type
number- Default
- —
- Requirement
- required
- Prop
unit- Type
string | undefined- Default
- —
- Requirement
- optional
- Prop
color- Type
string | undefined- Default
- —
- Requirement
- optional
- Prop
goodDirection- Type
"up" | "down" | undefined- Default
- —
- Requirement
- optional
- Prop
format- Type
((value: number) => string) | undefined- Default
- —
- Requirement
- optional
- Prop
sample- Type
((previous: number) => number) | undefined- Default
- —
- Requirement
- optional
- Prop
points- Type
number | undefined- Default
- —
- Requirement
- optional
- Prop
intervalMs- Type
number | undefined- Default
- —
- Requirement
- optional
- Prop
paused- Type
boolean | undefined- Default
- —
- Requirement
- optional
- Prop
renderer- Type
ChartRenderer | undefined- Default
- —
- Requirement
- optional
- Prop
className- Type
string | undefined- Default
- —
- Requirement
- optional
- Prop
theme- Type
import("@grassroot/theme").PartialChartTheme | undefined- Default
- —
- Requirement
- optional
- Prop
animation- Type
import("@grassroot/theme").ChartAnimationInput | undefined- Default
- —
- Requirement
- optional
- Prop
title- Type
string | undefined- Default
- —
- Requirement
- optional
- Prop
description- Type
string | undefined- Default
- —
- Requirement
- optional
- Prop
ariaLabel- Type
string | undefined- Default
- —
- Requirement
- optional
- Prop
keyboardNavigation- Type
boolean | undefined- Default
- —
- Requirement
- optional
Content regions
childrendataSummary
Native attributes
Standard DOM and ARIA attributes not listed above spread onto the root element.
Import
import { MetricCard } from "@grassroot/charts-vue";
Props
Prop
Type
Default
Requirement
valuenumber—
required
labelstring—
required
displaystring | undefined—
optional
colorstring | undefined—
optional
unitstring | undefined—
optional
goodDirection"up" | "down" | undefined"up"optional
format((value: number) => string) | undefined—
optional
sample((previous: number) => number) | undefined—
optional
pointsnumber | undefined22optional
intervalMsnumber | undefined1250optional
pausedboolean | undefinedfalseoptional
ariaLabelstring | undefined—
optional
rendererChartRenderer | undefined—
optional
themePartialChartTheme | undefined—
optional
- Prop
value- Type
number- Default
- —
- Requirement
- required
- Prop
label- Type
string- Default
- —
- Requirement
- required
- Prop
display- Type
string | undefined- Default
- —
- Requirement
- optional
- Prop
color- Type
string | undefined- Default
- —
- Requirement
- optional
- Prop
unit- Type
string | undefined- Default
- —
- Requirement
- optional
- Prop
goodDirection- Type
"up" | "down" | undefined- Default
"up"- Requirement
- optional
- Prop
format- Type
((value: number) => string) | undefined- Default
- —
- Requirement
- optional
- Prop
sample- Type
((previous: number) => number) | undefined- Default
- —
- Requirement
- optional
- Prop
points- Type
number | undefined- Default
22- Requirement
- optional
- Prop
intervalMs- Type
number | undefined- Default
1250- Requirement
- optional
- Prop
paused- Type
boolean | undefined- Default
false- Requirement
- optional
- Prop
ariaLabel- Type
string | undefined- Default
- —
- Requirement
- optional
- Prop
renderer- Type
ChartRenderer | undefined- Default
- —
- Requirement
- optional
- Prop
theme- Type
PartialChartTheme | undefined- Default
- —
- Requirement
- optional
- Prop
animation- Type
ChartAnimationInput | undefined- Default
undefined- Requirement
- optional
- Prop
title- Type
string | undefined- Default
- —
- Requirement
- optional
- Prop
description- Type
string | undefined- Default
- —
- Requirement
- optional
- Prop
keyboardNavigation- Type
boolean | undefined- Default
- —
- Requirement
- optional
- Prop
className- Type
string | undefined- Default
- —
- Requirement
- optional
Content regions
dataSummarydefault
Import
import { ChangeDetectionStrategy, Component } from "@angular/core";
import { GrassrootMetricCard } from "@grassroot/charts-angular";
Props
Prop
Type
Default
Requirement
valuenumber—
required
labelstring—
required
displaystring—
optional
colorstring—
optional
unitstring—
optional
goodDirection"up" | "down""up"optional
format(value: number) => string—
optional
sample(previous: number) => number—
optional
pointsnumber22optional
intervalMsnumber1250optional
pausedbooleanfalseoptional
ariaLabelstring—
optional
rendererChartRenderer—
optional
themePartialChartTheme—
optional
- Prop
value- Type
number- Default
- —
- Requirement
- required
- Prop
label- Type
string- Default
- —
- Requirement
- required
- Prop
display- Type
string- Default
- —
- Requirement
- optional
- Prop
color- Type
string- Default
- —
- Requirement
- optional
- Prop
unit- Type
string- Default
- —
- Requirement
- optional
- Prop
goodDirection- Type
"up" | "down"- Default
"up"- Requirement
- optional
- Prop
format- Type
(value: number) => string- Default
- —
- Requirement
- optional
- Prop
sample- Type
(previous: number) => number- Default
- —
- Requirement
- optional
- Prop
points- Type
number- Default
22- Requirement
- optional
- Prop
intervalMs- Type
number- Default
1250- Requirement
- optional
- Prop
paused- Type
boolean- Default
false- Requirement
- optional
- Prop
ariaLabel- Type
string- Default
- —
- Requirement
- optional
- Prop
renderer- Type
ChartRenderer- Default
- —
- Requirement
- optional
- Prop
theme- Type
PartialChartTheme- Default
- —
- Requirement
- optional
- Prop
animation- Type
ChartAnimationInput- Default
- —
- Requirement
- optional
- Prop
title- Type
string- Default
- —
- Requirement
- optional
- Prop
description- Type
string- Default
- —
- Requirement
- optional
- Prop
keyboardNavigation- Type
boolean- Default
- —
- Requirement
- optional
- Prop
className- Type
string- Default
- —
- Requirement
- optional
Content regions
dataSummarydefault
Import
import { MetricCard } from "@grassroot/charts-svelte";
Props
Prop
Type
Default
Requirement
valuenumber—
required
labelstring—
required
displaystring—
optional
colorstring—
optional
unitstring—
optional
goodDirection"up" | "down""up"optional
format(value: number) => string—
optional
sample(previous: number) => number—
optional
pointsnumber22optional
intervalMsnumber1250optional
pausedbooleanfalseoptional
ariaLabelstring—
optional
rendererChartRenderer—
optional
themePartialChartTheme—
optional
- Prop
value- Type
number- Default
- —
- Requirement
- required
- Prop
label- Type
string- Default
- —
- Requirement
- required
- Prop
display- Type
string- Default
- —
- Requirement
- optional
- Prop
color- Type
string- Default
- —
- Requirement
- optional
- Prop
unit- Type
string- Default
- —
- Requirement
- optional
- Prop
goodDirection- Type
"up" | "down"- Default
"up"- Requirement
- optional
- Prop
format- Type
(value: number) => string- Default
- —
- Requirement
- optional
- Prop
sample- Type
(previous: number) => number- Default
- —
- Requirement
- optional
- Prop
points- Type
number- Default
22- Requirement
- optional
- Prop
intervalMs- Type
number- Default
1250- Requirement
- optional
- Prop
paused- Type
boolean- Default
false- Requirement
- optional
- Prop
ariaLabel- Type
string- Default
- —
- Requirement
- optional
- Prop
renderer- Type
ChartRenderer- Default
- —
- Requirement
- optional
- Prop
theme- Type
PartialChartTheme- Default
- —
- Requirement
- optional
- Prop
animation- Type
ChartAnimationInput- Default
- —
- Requirement
- optional
- Prop
title- Type
string- Default
- —
- Requirement
- optional
- Prop
description- Type
string- Default
- —
- Requirement
- optional
- Prop
keyboardNavigation- Type
boolean- Default
- —
- Requirement
- optional
- Prop
class- Type
string- Default
- —
- Requirement
- optional
Content regions
childrendataSummary
Import
import { MetricCard } from "@grassroot/charts-solid";
Props
Prop
Type
Default
Requirement
valuenumber—
required
labelstring—
required
displaystring—
optional
colorstring—
optional
unitstring""optional
goodDirection"up" | "down""up"optional
format(value: number) => string—
optional
sample(previous: number) => number—
optional
pointsnumber22optional
intervalMsnumber1250optional
pausedbooleanfalseoptional
classstring—
optional
ariaLabelstring—
optional
rendererChartRenderer"auto"optional
- Prop
value- Type
number- Default
- —
- Requirement
- required
- Prop
label- Type
string- Default
- —
- Requirement
- required
- Prop
display- Type
string- Default
- —
- Requirement
- optional
- Prop
color- Type
string- Default
- —
- Requirement
- optional
- Prop
unit- Type
string- Default
""- Requirement
- optional
- Prop
goodDirection- Type
"up" | "down"- Default
"up"- Requirement
- optional
- Prop
format- Type
(value: number) => string- Default
- —
- Requirement
- optional
- Prop
sample- Type
(previous: number) => number- Default
- —
- Requirement
- optional
- Prop
points- Type
number- Default
22- Requirement
- optional
- Prop
intervalMs- Type
number- Default
1250- Requirement
- optional
- Prop
paused- Type
boolean- Default
false- Requirement
- optional
- Prop
class- Type
string- Default
- —
- Requirement
- optional
- Prop
ariaLabel- Type
string- Default
- —
- Requirement
- optional
- Prop
renderer- Type
ChartRenderer- Default
"auto"- Requirement
- optional
- Prop
theme- Type
PartialChartTheme- Default
- —
- Requirement
- optional
- Prop
animation- Type
ChartAnimationInput- Default
- —
- Requirement
- optional
- Prop
title- Type
string- Default
- —
- Requirement
- optional
- Prop
description- Type
string- Default
- —
- Requirement
- optional
- Prop
keyboardNavigation- Type
boolean- Default
- —
- Requirement
- optional
Content regions
childrendataSummary