Pular para o conteúdo

Stats

Exiba estatísticas e dados em blocos organizados para dashboards e análises.

import { Stats } from 'asterui'

Stat Básico

Stat simples com título e valor.

Total Page Views
89,400
import { Stats } from 'asterui'

function App() {
  return (
      <Stats className="shadow">
        <Stats.Stat title="Total Page Views" value="89,400" />
      </Stats>
    )
}

export default App

Com Descrição

Adicione descrição usando a prop desc.

Downloads
31K
Jan 1st - Feb 1st
import { Stats } from 'asterui'

function App() {
  return (
      <Stats className="shadow">
        <Stats.Stat title="Downloads" value="31K" desc="Jan 1st - Feb 1st" />
      </Stats>
    )
}

export default App

Múltiplos Stats

Exiba múltiplos stats horizontalmente.

Total Users
4,200
↗︎ 400 (22%)
New Users
1,200
↘︎ 90 (14%)
New Registers
4,200
↗︎ 400 (22%)
import { Stats } from 'asterui'

function App() {
  return (
      <Stats className="shadow">
        <Stats.Stat title="Total Users" value="4,200" desc="↗︎ 400 (22%)" />
        <Stats.Stat title="New Users" value="1,200" desc="↘︎ 90 (14%)" />
        <Stats.Stat title="New Registers" value="4,200" desc="↗︎ 400 (22%)" />
      </Stats>
    )
}

export default App

Com Ícones

Adicionando ícones usando a prop figure.

Downloads
31K
Jan 1st - Feb 1st
New Users
4,200
↗︎ 400 (22%)
import { Stats } from 'asterui'
import { InformationCircleIcon, AdjustmentsVerticalIcon } from '@aster-ui/icons'

function App() {
  return (
      <Stats className="shadow">
        <Stats.Stat
          figure={<InformationCircleIcon size={32} />}
          title="Downloads"
          value="31K"
          desc="Jan 1st - Feb 1st"
        />
        <Stats.Stat
          figure={<AdjustmentsVerticalIcon size={32} />}
          title="New Users"
          value="4,200"
          desc="↗︎ 400 (22%)"
        />
      </Stats>
    )
}

export default App

Valores Coloridos

Usando className para valores coloridos.

Account balance
$89,400
21% more than last month
Current balance
$12,721
12% less than last month
import { Stats } from 'asterui'

function App() {
  return (
      <Stats className="shadow">
        <Stats.Stat
          title="Account balance"
          value={<span className="text-primary">$89,400</span>}
          desc="21% more than last month"
        />
        <Stats.Stat
          title="Current balance"
          value={<span className="text-secondary">$12,721</span>}
          desc="12% less than last month"
        />
      </Stats>
    )
}

export default App

Layout Vertical

Empilhe stats verticalmente.

Downloads
31K
Jan 1st - Feb 1st
New Users
4,200
↗︎ 400 (22%)
New Registers
1,200
↘︎ 90 (14%)
import { Stats } from 'asterui'

function App() {
  return (
      <Stats vertical className="shadow">
        <Stats.Stat title="Downloads" value="31K" desc="Jan 1st - Feb 1st" />
        <Stats.Stat title="New Users" value="4,200" desc="↗︎ 400 (22%)" />
        <Stats.Stat title="New Registers" value="1,200" desc="↘︎ 90 (14%)" />
      </Stats>
    )
}

export default App

Com Ações

Adicionando botões usando a prop actions.

Account balance
$89,400
import { Stats, Button } from 'asterui'

function App() {
  return (
      <Stats className="shadow">
        <Stats.Stat
          title="Account balance"
          value="$89,400"
          actions={
            <Button size="sm" color="primary">
              Add funds
            </Button>
          }
        />
      </Stats>
    )
}

export default App
PropriedadeDescriçãoTipoPadrão
childrenItens stat a exibirReact.ReactNode-
verticalEmpilhar stats verticalmentebooleanfalse
classNameClasses CSS adicionaisstring-
data-testidID de teste para testesstring-
PropriedadeDescriçãoTipoPadrão
titleTítulo do statReact.ReactNode-
valueValor do statReact.ReactNode-
descTexto de descriçãoReact.ReactNode-
figureFigura de ícone ou imagemReact.ReactNode-
actionsBotões ou elementos de açãoReact.ReactNode-
classNameClasses CSS adicionaisstring-
data-testidID de teste para testesstring-
  • Estrutura de cabeçalho semântica para títulos de stat
  • Valores podem incluir labels ARIA para contexto
  • Figuras têm texto alt apropriado ao usar imagens
  • Botões de ação são acessíveis por teclado