Web Counter

Display a page-view count on rolling digits styled like a mechanical odometer.

Sample counter

1,234 Page views · last 30 days

Usage

Web Counter HTML · HTML
<script type="module" src="./index.js"></script>
<web-counter value="1234"></web-counter>

Keep index.js and styles.css together. The element loads its stylesheet and renders the wheels from the value attribute. The live sample uses declarative shadow DOM so its wheels are visible without JavaScript.

Set leading-zeros to an integer from 0 through 16. The default is one leading zero.

ES module · Stylesheet · Custom Elements Manifest · Component README