Absolutely, Dan! Here’s how to add font sizing to your Animated Stats Counter using the themeTextStyle property from the Elements API, giving you full theme-driven control via the Theme Studio. You’ll get everything—properties file and Template file—totally Elements-native and ready to roll.
properties.json
{
"groups": [
{
"title": "Card",
"properties": [
{
"title": "Background Color",
"id": "backgroundColor",
"format": "bg-{{value}}",
"themeColor": {
"default": {
"name": "surface",
"brightness": 900
}
}
},
{
"title": "Number",
"id": "myNumber",
"number": {
"default": 100,
"subtitle": "a simple number input"
}
},
{
"title": "Text Style",
"id": "headingTextStyles",
"themeTextStyle": {
"default": {
"base": {
"name": "3xl"
}
}
}
}
]
}
]
}
Template.html
<div
class="card flex flex-col items-center justify-center p-6 gap-2 shadow-lg rounded-lg {{backgroundColor}}"
x-data="{ count: 0, hasAnimated: false }"
x-intersect.once="if (!hasAnimated) { hasAnimated = true; $nextTick(() => { let start = 0; let end = +{{myNumber}}; let duration = 1500; let startTime = null; function animate(now) { if(!startTime) startTime = now; let progress = Math.min((now - startTime) / duration, 1); count = Math.floor(progress * (end - start) + start); if(progress < 1){ requestAnimationFrame(animate); } } requestAnimationFrame(animate); }); }"
>
@if(edit)
<div class="font-bold text-primary-900 {{headingTextStyles}}">{{myNumber}}</div>
@else
<div class="font-bold text-primary-900 {{headingTextStyles}}" x-text="count"></div>
@endif
<!-- Add a label or other props below as needed -->
</div>
- The font size and style of the counter is now driven by the “Text Style” themeTextStyle property, injected with {{headingTextStyles}}, making your component super flexible and perfectly theme-compatible.
- All controls remain 100% managed by the Theme Studio—so you get that signature Elements flexibility with a clean, modern workflow.
Want a label or even more theme controls? Just @elementsbot and let’s make your components shine.
That’s the Power of Elements!