Number Counter

Displays a number with commas for thousands.
Overview API

Usage

Here are different types of inputs.


  <wc-number-counter id="number-counter" value="4282828"></wc-number-counter>

  <script>
    customElements.whenDefined('wc-number-counter').then(() => {
      const $counter = document.querySelector('#number-counter');

      setInterval(() => {
        $counter.value = $counter.value + Math.floor(Math.random() * 1000);
      }, 1000);
    });
  </script>

On this page

Properties

Events

Methods

CSS Custom Properties