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
| Prop | Type | Default | Description |
|---|---|---|---|
figures | SalesFigures | required | The period's figures, with an optional comparison and hourly series |
filters | SalesFilters | required | The current filters; the preset and range pick the comparison label |
onFiltersChange | (next: SalesFilters) => void | required | Called with the new compare value when a single-day comparison is chosen |
currency | string | required | Currency of the figures' minor units |
See SalesFilters for the filter shape.