Tally UI

SalesHero

Show the period's gross sales, its change against the comparison period and a chart of both.

Import

import { SalesHero } from '@tallyui/components';

Usage

<SalesHero figures={figures} filters={filters} onFiltersChange={setFilters} currency="NZD" />

The hero shows the gross total and its percentage change, then Orders, Average order and Items, each with its own change. A change shows — when there is no comparison period or it has no orders. The chart draws a bar per day, or per hour when figures.hourly is set, with the comparison period's bar beside each one. The bars use theme token classes, so the chart takes its colours from the theme.

The comparison label follows the period: “vs the week before” for a week, “vs the month before” for a month. For a single day the hero offers two choices, “vs yesterday” and “vs last” followed by the weekday, and pressing one calls onFiltersChange with a new compare value. SalesRoom renders the hero between its filters and its cards.

Props

PropTypeDefaultDescription
figuresSalesFiguresrequiredThe period's figures, with an optional comparison and hourly series
filtersSalesFiltersrequiredThe current filters; the preset and range pick the comparison label
onFiltersChange(next: SalesFilters) => voidrequiredCalled with the new compare value when a single-day comparison is chosen
currencystringrequiredCurrency of the figures' minor units

See SalesFilters for the filter shape.

On this page