Build faster with Premium Chakra UI Components 💎

Learn more
Skip to Content
DocsPlaygroundGuidesBlog
Sponsor

Stat

Used to display a statistic with a title and value.

SourceStorybookRecipe
Unique visitors
192.1k

Setup

If you don't already have the snippet, run the following command to add the stat snippet

chakra snippet add stat

The snippet includes a closed component composition for the Stat component.

Usage

import { StatLabel, StatRoot, StatValueText } from "@/components/ui/stat"
<StatRoot>
  <StatLabel />
  <StatValueText />
  <StatHelpText>
    <StatUpIndicator />
    <StatDownIndicator />
  </StatHelpText>
</StatRoot>

Examples

Format Options

Pass the formatOptions to the StatValueText component to format the value.

Revenue
$935.40

Indicator

Here's an example of how to display a statistic with an indicator.

Unique visitors
192.1k
1.9%

Info Tip

Pass the info prop to the StatLabel component to display an info tip.

Unique
192.1k

Value Unit

Here's an example of how to display a value with a unit.

Time to complete
3 hr20 min

Progress Bar

Here's an example of how to display a statistic with a progress bar.

This week
$1,340
+12% from last week

Icon

Here's an example of how to display a statistic with an icon.

Sales
$4.24k

Trend

Here's an example of how to display a statistic with a trend indicator.

Unique
$8,456.40
12%
since last month

Props

Root

PropDefaultType
colorPalette 'gray'
'gray' | 'red' | 'orange' | 'yellow' | 'green' | 'teal' | 'blue' | 'cyan' | 'purple' | 'pink' | 'accent'

The color palette of the component

size 'md'
'sm' | 'md' | 'lg'

The size of the component

as
React.ElementType

The underlying element to render.

asChild
boolean

Use the provided child element as the default rendered element, combining their props and behavior.

For more details, read our Composition guide.
unstyled
boolean

Whether to remove the component's style.

Previous

Spinner

Next

Status