Skip to main content

Stat

Rocket 2.0

The Stat component is a KPI card that shows one key figure with its label, such as total revenue or open tickets. It can add a change chip, an icon, a small trend line and a progress bar.

Properties​

Property
Description
Expected Value
LabelText shown above the figure, such as Total revenue.Text. Default: Total revenue
ValueThe figure to show. Numbers get digit grouping; text shows as written.Text. Default: 1250
Value formatHow the figure is written, such as plain numbers, currency, percent or short forms like 12K. Auto keeps it as given.Auto, Number, Currency, Percent, Compact. Default: Auto
Currency (ISO code, e.g. USD)Currency code used when Value format or Change format is currency, such as USD or EUR.Text. Default: USD
LocaleLocale used to format numbers and currency, such as en-US. Leave empty to follow the currency.Text
Change (e.g. +12.5%)Change shown in a chip next to the figure, such as +12.5%. A leading + or - sets whether it points up or down.Text
Change formatHow a numeric Change is written.Percent, Number, Currency. Default: Number
TrendDirection of the change chip when Change has no sign of its own.Up, Down, Neutral. Default: Up
Change context (e.g. vs last month)Text shown after the change chip, such as vs last month.Text
FootnoteSmall text shown at the bottom of the card.Text
Icon (lucide name, e.g. wallet)Icon shown on the card, by Lucide or Tabler name, such as wallet.Text
Icon positionWhere the icon sits: to the right or left of the figure, or above it.Right, Left, Top. Default: Right
Icon styleBackground behind the icon: a rounded Square, a Circle, or None.Square, Circle, None. Default: Square
Trend data (numbers or [{ x, y }])Values for a small trend line at the bottom of the card, as numbers or { x, y } objects.Text
Trend lineDraw the trend line as a filled Area or a plain Line.Area, Line. Default: Area
Progress (0 to 100)Percent from 0 to 100 shown as a progress bar on the card.Text
Progress labelText shown with the progress bar.Text
SizeSize of the figure and the spacing of the card.Sm, Default, Lg. Default: Default
Show as cardDraws the stat in a card with a border and background. When off, it sits directly on the page.On or off. Default: On
Loading lookWhat shows while the stat is loading: a spinner or a skeleton outline.Spinner, Skeleton. Default: Spinner

Additional Actions​

Each of these can be switched on or off, or set with a logical expression by clicking fx.

Property
Description
Expected Value
VisibilityShows or hides the component. Hidden components keep their space unless Collapse when hidden is on.On or off. Default: On
Collapse when hiddenRemoves the hidden component's space, so the components below it move up.On or off. Default: Off
Loading stateShows the component's loading look and blocks interaction, for example while a query runs.On or off. Default: Off
DisableStops the user from interacting with the component.On or off. Default: Off
Dynamic heightLets the component grow with its content in the running app instead of keeping a fixed height.On or off. Default: Off

Devices​

Property
Description
Expected Value
Show on desktopShows the component in the desktop layout.On or off. Default: On
Show on mobileShows the component in the mobile layout.On or off. Default: Off

Events​

Add a handler from the Events section of the properties panel. See Event Triggers for the steps.

Event
Description
On clickTriggers when the user clicks the stat.

Component Specific Actions (CSA)​

Run these from an event handler with Control Component, or from a RunJS query. See Component Specific Actions.

Action
Description
How To Access
Set primary valueSets the figure to the given Value.components.stat1.setPrimaryValue("")
Set secondary valueSets the change chip to the given Change.components.stat1.setSecondaryValue("")
Set trendSets the direction of the change chip to up, down or neutral.components.stat1.setTrend("up")
Set visibilityShows the component when true, hides it when false.components.stat1.setVisibility(false)
Set disableDisables the component when true, enables it when false.components.stat1.setDisable(false)
Set loadingTurns the loading state on with true, off with false.components.stat1.setLoading(false)

Exposed Variables​

Variable
Description
How To Access
labelText shown above the figure, such as Total revenue.{{components.stat1.label}}
valueThe figure to show. Numbers get digit grouping; text shows as written.{{components.stat1.value}}
valueFormatHow the figure is written, such as plain numbers, currency, percent or short forms like 12K. Auto keeps it as given.{{components.stat1.valueFormat}}
currencyCurrency code used when Value format or Change format is currency, such as USD or EUR.{{components.stat1.currency}}
localeLocale used to format numbers and currency, such as en-US. Leave empty to follow the currency.{{components.stat1.locale}}
changeChange shown in a chip next to the figure, such as +12.5%. A leading + or - sets whether it points up or down.{{components.stat1.change}}
changeFormatHow a numeric Change is written.{{components.stat1.changeFormat}}
trendDirection of the change chip when Change has no sign of its own.{{components.stat1.trend}}
changeLabelText shown after the change chip, such as vs last month.{{components.stat1.changeLabel}}
footnoteSmall text shown at the bottom of the card.{{components.stat1.footnote}}
iconIcon shown on the card, by Lucide or Tabler name, such as wallet.{{components.stat1.icon}}
iconPositionWhere the icon sits: to the right or left of the figure, or above it.{{components.stat1.iconPosition}}
iconStyleBackground behind the icon: a rounded Square, a Circle, or None.{{components.stat1.iconStyle}}
trendDataValues for a small trend line at the bottom of the card, as numbers or { x, y } objects.{{components.stat1.trendData}}
sparklineTypeDraw the trend line as a filled Area or a plain Line.{{components.stat1.sparklineType}}
progressPercent from 0 to 100 shown as a progress bar on the card.{{components.stat1.progress}}
progressLabelText shown with the progress bar.{{components.stat1.progressLabel}}
sizeSize of the figure and the spacing of the card.{{components.stat1.size}}
cardDraws the stat in a card with a border and background. When off, it sits directly on the page.{{components.stat1.card}}
loadingIndicatorWhat shows while the stat is loading: a spinner or a skeleton outline.{{components.stat1.loadingIndicator}}
primaryLabelThe label shown above the figure.{{components.stat1.primaryLabel}}
primaryValueThe figure shown, including one set with Set primary value.{{components.stat1.primaryValue}}
secondaryLabelThe change context text.{{components.stat1.secondaryLabel}}
secondaryValueThe change shown in the chip.{{components.stat1.secondaryValue}}
isVisibleWhether the component is visible.{{components.stat1.isVisible}}
isLoadingWhether the component is in its loading state.{{components.stat1.isLoading}}
isDisabledWhether the component is disabled.{{components.stat1.isDisabled}}

Styles​

Style
Default
Card shadow0px 0px 0px 0px #00000040
Card backgroundTheme: Surface 1
Card border colorTheme: Default border
Card radius—
Label colorTheme: Placeholder text
Value colorTheme: Primary text
Footnote colorTheme: Placeholder text
Change color when trend is upTheme: Primary text
Change color when trend is downTheme: Primary text
Icon colorTheme: Brand primary
Icon tile colorTheme: Brand primary
Trend line colorTheme: Brand primary
Progress colorTheme: Brand primary
Value typefaceTheme font
Label casingAs typed
Label letter spacing (px, or em like 0.12em)—
Box shadow0px 0px 0px 0px #00000040

A default that starts with Theme: follows the app's theme until the style is set to another value. See App Themes.