Skip to main content

Stats (ALPHA)

Alpha feature: invite only

Responsive Widgets are in alpha and available by invitation only on Business and Enterprise plans. Behavior and properties may change. To request access, open a support ticket and name the feature Responsive Widgets (ALPHA).

The Stats widget shows one key number in a card, such as active users or monthly revenue. It can also show a change value, a caption, an icon, and a small trend line (sparkline). Use several Stats widgets side by side to build a KPI row on a dashboard.

Widget type: WDS_STATS_WIDGET

Stats widget in a Responsive app
Stats widget

Loading state​

While its data loads for the first time, the widget shows a loading placeholder in the card. When data reloads and the widget already has a value, it keeps showing the old value until the new one arrives. A value of 0 counts as data.

Content properties​

These properties appear in the Content tab of the property pane.

Fields​

Label string​

Sets the label for the number, for example Active users. Default: Active Users. The label shows on one line.

Value string​

Sets the main number or text. Default: 42. You can bind data to it, for example {{GetStats.data.activeUsers}}. If the value is empty, the widget hides it, and it hides Value change too.

Value color string​

Sets the semantic color of the value and the icon. Options: Default, Accent, Neutral, Positive, Negative, Warning. A new widget starts with Neutral.

Values for code: default, accent, neutral, positive, negative, warning.

Optional Fields​

Select icon string​

Sets the icon in the card. Default: shopping-bag. If the value is empty or (none), the card shows no icon.

Position string​

Sets which side of the card the icon is on. Options: start (default), end.

Values for code: start, end.

You set this property in the property pane only. You cannot bind it to data.

Value change string​

Sets a short text next to the value, such as the change since last period. Default: +50%.

Color string​

Sets the semantic color of Value change. Options: Accent, Neutral, Positive, Negative, Warning. A new widget starts with Positive.

Values for code: accent, neutral, positive, negative, warning.

Caption string​

Sets a short text under the value, for example Since 21 Jan 2022. Default: This week.

Sparkline data array​

Sets an array of numbers to draw as a small trend line under the value. Default: [10, 14, 9, 16, 12, 20, 18]. Leave it empty to hide the sparkline.

Example:

{{ GetStats.data.dailyUsers.map(d => d.count) }}

General​

Visible boolean​

Controls whether the widget is visible. Default: on.

Animate loading boolean​

Controls the loading animation of the widget. Default: on.

Style properties​

These properties appear in the Style tab of the property pane.

General​

Alignment string​

Sets the horizontal alignment of the text in the card. Options: left (default), center.

Values for code: start, center.

Value position string​

Shows the value below or above the label. Options: Below label (default), Above label.

Values for code: bottom, top.

Value size string​

Sets the text size of the value. Options: Subtitle (default), Title, Heading.

Values for code: subtitle, title, heading.

Visual Separation boolean​

Gives the card an elevated background, borders, or both, so it stands out from the rest of the page. Default: off.

Custom styling​

These settings are in the Custom styling section, at the end of the Style tab. An empty setting uses the theme value. For theme colors, dark mode, and the rules for custom CSS, see Custom styling.

Accent color string​

Builds the hover, pressed, focus, and text colors of this widget from one color, in light and dark mode. Lists and menus that the widget opens use them too. Empty means the accent of the nearest container that sets one, or the theme accent.

Background string​

Sets the background of the widget surface. Takes a custom color or a gradient, not a theme color.

Examples:

#def7ec
linear-gradient(135deg, #6366f1, #8b5cf6)

Text color string​

Sets the text color of the widget surface. Takes a theme color or a custom color. When it is empty and Background is set, the widget picks a readable text color.

Border color string​

Sets the border color of the widget surface. Takes a custom color only. A color with no Border width draws a thin border.

Border width string​

Sets the border width of the widget surface. Options: From theme (default), None, Thin, Medium, Thick. You cannot bind this property.

Corners string​

Sets the corner radius of the widget surface. Options: From theme (default), Sharp, Rounded, Pill. You cannot bind this property.

Custom CSS string​

Adds plain CSS to this widget. Rules apply only inside the widget, and & is the widget surface. You cannot bind this property.

Reference properties​

Reference properties let you read the widget's state in bindings and code, for example {{StatsWidget1.isVisible}}. You cannot set them directly.

isVisible boolean​

Shows whether the widget is visible.

Example:

{{StatsWidget1.isVisible}}

Methods​

Methods let you change the widget's properties from code, for example in a JS Object.

setVisibility (param: boolean): Promise​

Shows or hides the widget.

Example:

StatsWidget1.setVisibility(false)