The Statistic component for Retool Apps
A content area to display primary and secondary number values with optional trend indicators.
For more information about this component, refer to the Informational components guide.
Properties
All properties for this object with supported data types or values. You can write JavaScript almost anywhere in Retool to manipulate or read property values.
align
The horizontal alignment of the contents.
Type | string | ||||||||
Format | Plain Text | ||||||||
Mutability |
| ||||||||
Allowed Values |
| ||||||||
Default |
|
Examples
"center"
clickable
Whether there is an enabled Click event handler.
Type | boolean | ||||
Format | True/False | ||||
Mutability |
| ||||
Default |
|
Examples
true
currency
A three-letter ISO currency code to use if format
is currency
.
Type | string | ||||
Mutability |
|
decimalPlaces
The number of decimal places to display. If necessary, values round up or down automatically.
Type | number | ||||
Format | Integer | ||||
Mutability |
|
enableTrend
Whether to render the value using positive
or negative
color styles based on whether the secondary value is positive or negative.
Type | boolean | ||||
Mutability |
|
formattingStyle
The formatting style to use.
Type | string | ||||||||
Mutability |
| ||||||||
Allowed Values |
|
hidden
Whether this object is hidden from view.
Type | boolean | ||||||
Format | True/False | ||||||
Mutability |
| ||||||
Default |
|
Examples
true
icon
the icon to display.
Type | string | ||||
Format | Icon Key | ||||
Mutability |
| ||||
Default |
|
Examples
/icon:bold/shopping-gift
id
The unique identifier (name).
Type | string | ||||
Format | Plain Text | ||||
Mutability |
| ||||
Default |
|
Examples
query1
button1
isHiddenOnDesktop
Whether to show or hide this object in the desktop layout.
Type | boolean | ||||
Format | True/False | ||||
Mutability |
| ||||
Default |
|
Examples
true
isHiddenOnMobile
Whether to show or hide this object in the mobile layout.
Type | boolean | ||||
Format | True/False | ||||
Mutability |
| ||||
Default |
|
Examples
true
label
The text label to display.
Type | string | ||||
Format | Plain Text | ||||
Mutability |
| ||||
Default |
|
Examples
"Label"
labelCaption
The additional text to display with the label.
Type | string | ||||
Format | Plain Text | ||||
Mutability |
|
maintainSpaceWhenHidden
Whether to take up space on the canvas if hidden
is true
.
Type | boolean | ||||
Format | True/False | ||||
Mutability |
| ||||
Default |
|
Examples
true
margin
The amount of margin to render outside.
Type | string | |||||||||
Format | Plain Text | |||||||||
Mutability |
| |||||||||
Allowed Values |
| |||||||||
Default |
|
Examples
4px 8px
padDecimal
Whether to include trailing zeros to match the specified value for decimalPlaces
.
Type | boolean | ||||
Mutability |
|
positiveTrend
Whether to display a positive trend for the secondary value.
Type | boolean |
Mutability | Read-only |
prefix
The prefix text to display.
Type | string | ||||
Format | Plain Text | ||||
Mutability |
| ||||
Default |
|
Examples
$
Email address
SKU
secondaryCurrency
The three-letter ISO currency code to use if format
is currency
.
Type | string | ||||
Mutability |
|
secondaryDecimalPlaces
The number of decimal places to display for the secondary value.
Type | number | ||||
Mutability |
|
secondaryEnableTrend
Whether to display the trend color for the secondary value.
Type | boolean | ||||
Mutability |
|
secondaryFormattingStyle
The formatting style for the secondary value.
Type | string | ||||||||
Mutability |
| ||||||||
Allowed Values |
|
secondaryPadDecimal
Whether to pad the secondary value with zeros.
Type | boolean | ||||
Mutability |
|
secondaryPositiveTrend
Whether to display a positive trend for the secondary value.
Type | boolean |
Mutability | Read-only |
secondaryPrefix
The prefix for the secondary value.
Type | string | ||||
Mutability |
|
secondaryShowSeparators
Whether to show separators for the secondary value.
Type | boolean | ||||
Mutability |
|
secondarySignDisplay
The sign display.
Type | string | ||||||||
Mutability |
| ||||||||
Allowed Values |
|
secondarySuffix
The suffix text to display.
Type | string | ||||
Format | Plain Text | ||||
Mutability |
| ||||
Default |
|
Examples
USD
px
@example.com
showInEditor
Whether the component remains visible in the editor if hidden
is true
.
Type | boolean | ||||
Format | True/False | ||||
Mutability |
| ||||
Default |
|
Examples
true
showSeparators
Whether the formatted value includes a localized thousands separator.
Type | boolean | ||||
Mutability |
|
signDisplay
The sign display.
Type | string | ||||||||
Mutability |
| ||||||||
Allowed Values |
|
style
Custom style options.
Type | object | ||||
Mutability |
|
suffix
The suffix text to display.
Type | string | ||||
Format | Plain Text | ||||
Mutability |
| ||||
Default |
|
Examples
USD
px
@example.com
Methods
JavaScript API methods for this object. You can write JavaScript almost anywhere in Retool and use methods to manipulate data and property values.
statistic.clearValue()
Examples
Clear the current value of statistic
.
statistic.clearValue();
statistic.resetValue()
Examples
Reset the current value of statistic
.
statistic.resetValue();
statistic.scrollIntoView()
Scrolls the canvas or parent container so that the selected component appears in the visible area.
statistic.scrollIntoView(options)
Parameters
Object Properties
behavior
The scroll behavior.
Type | string | ||||||
Allowed Values |
|
block
The scroll position relative to the component.
Type | string | ||||||||||
Allowed Values |
|
Examples
Scroll the minimum amount to immediately bring statistic
into view.
statistic.scrollIntoView({behavior: 'auto', block: 'nearest'});
statistic.setHidden()
Set the hidden
value to toggle whether the component is visible. Defaults to true
without a parameter.
statistic.setHidden(hidden)
Parameters
Examples
true
Examples
Hide statistic
.
statistic.setHidden(true);
Unhide statistic
.
statistic.setHidden(false);
statistic.setValue(value)
Examples
Set the current value of statistic
to userValue
.
statistic.setValue(userValue);
Events
Events triggered by user interactions. You can configure event handlers in the IDE to trigger queries or other actions in response to events.
Event | Description |
---|---|
Click | An item is clicked or pressed. |