Zum Hauptinhalt springen
VelinStyle v1.2.0
⌂ Home
  1. Docs
  2. Erste Schritte
  3. Zähler

Zähler 1.2.0

The <velin-counter> Web Komponente animates a number from from to to using requestAnimationFrame and an expo-out easing, then formats via Intl.NumberFormat. Designed for KPI tiles, hero stats, and pricing Seiten. English: Counter

Reifegrad: Dokumentiert als stabil in VelinStyle 1.2.0. Design Intelligence (Plan / Review / Agent-Meta) ist separat und Beta / Grundlage wo entsprechend angegeben.

Wann verwenden

Wann nicht verwenden

Grundlagen

<velin-counter from="0" to="2540" duration="1500"></velin-counter>

Currency & locale

<velin-counter from="0" to="61840"
  format="currency" currency="EUR" locale="de-DE"
  decimals="0" duration="1200"></velin-counter>

Prozent

<velin-counter from="0" to="0.94" format="percent" decimals="1"></velin-counter>

Attribut

AttributStandardHinweise
from0Startwert
to0Zielwert
duration900ms
decimalsautoFeste Nachkommastellen
formatnumbernumber / currency / percent
currencyEURISO 4217 code, used with format="currency"
localebrowserBCP-47 tag (e.g. de-DE, en-US)
prefix / suffixStrings wrapped around the formatted number
autostarttrueSet false to start manually via start()

JavaScript-API

const counter = document.querySelector('velin-counter');
counter.start();   // re-runs the animation
counter.reset();   // jumps back to "from"
counter.setAttribute('to', 99000); // implicit re-animate

Barrierefreiheit & reduced motion