Taggor

All components · Category: Pricing and counters

Stat counter

Big numbers that roll up when they come into view.

Figures that roll up digit by digit, rightmost first, the first time they appear on screen, and never again. Values, labels and units come from props. Without motion, or without a browser observer, the final numbers are simply there, and each one is read whole by a screen reader.

01

Try it

<stat-counter>
View

Props

Accent
Corners
stat-counter: Big numbers that roll up when they come into view. A picture of the real component, drawn from its own code. The controls change the picture and the code beside it; nothing here is sent or stored.

Generated from the component's manifest and the values above.

Code for

index.html

<stat-counter
  still
  locale="en"
  stats="[{&quot;value&quot;:100,&quot;label&quot;:&quot;Sites on the Agency plan&quot;},{&quot;value&quot;:24,&quot;label&quot;:&quot;Months of history on Pro&quot;},{&quot;value&quot;:14,&quot;label&quot;:&quot;Grace days past a limit&quot;}]"
></stat-counter>
  • Add the site's Taggor script once; the component appears when it loads.

taggor-component.js

const element = document.createElement("stat-counter");
element.setAttribute("still", "");
element.setAttribute("locale", "en");
element.stats = [
  {
    "value": 100,
    "label": "Sites on the Agency plan"
  },
  {
    "value": 24,
    "label": "Months of history on Pro"
  },
  {
    "value": 14,
    "label": "Grace days past a limit"
  }
];
document.body.append(element);
  • Add the site's Taggor script once; the component appears when it loads.
  • Lists and objects go in as a property of the element, not an attribute.

StatCounter.tsx

import { useEffect, useRef } from "react";

export function StatCounter() {
  const ref = useRef<HTMLElement>(null);

  useEffect(() => {
    const element = ref.current;
    if (!element) return;
    Object.assign(element, {
      stats: [
        {
          "value": 100,
          "label": "Sites on the Agency plan"
        },
        {
          "value": 24,
          "label": "Months of history on Pro"
        },
        {
          "value": 14,
          "label": "Grace days past a limit"
        }
      ],
    });
  }, []);

  return <stat-counter ref={ref} still="" locale="en" />;
}
  • Add the site's Taggor script once; the component appears when it loads.
  • React 18 sends every prop of a custom element as a text attribute.
  • Lists and objects go in as a property of the element, not an attribute.

StatCounter.tsx

import { useEffect, useRef } from "react";

export function StatCounter() {
  const ref = useRef<HTMLElement>(null);

  useEffect(() => {
    const element = ref.current;
    if (!element) return;
    Object.assign(element, {
      stats: [
        {
          "value": 100,
          "label": "Sites on the Agency plan"
        },
        {
          "value": 24,
          "label": "Months of history on Pro"
        },
        {
          "value": 14,
          "label": "Grace days past a limit"
        }
      ],
    });
  }, []);

  return <stat-counter ref={ref} still locale="en" />;
}
  • Add the site's Taggor script once; the component appears when it loads.
  • React 19 sets a property when the element already has it, an attribute otherwise.
  • Lists and objects go in as a property of the element, not an attribute.

src/StatCounter.vue

<template>
  <stat-counter
    :still.prop="true"
    locale="en"
    :stats.prop="[{&quot;value&quot;:100,&quot;label&quot;:&quot;Sites on the Agency plan&quot;},{&quot;value&quot;:24,&quot;label&quot;:&quot;Months of history on Pro&quot;},{&quot;value&quot;:14,&quot;label&quot;:&quot;Grace days past a limit&quot;}]"
  />
</template>

vite.config.ts

import vue from "@vitejs/plugin-vue";
import { defineConfig } from "vite";

export default defineConfig({
  plugins: [
    vue({
      template: {
        compilerOptions: {
          isCustomElement: (tag) => tag === "stat-counter",
        },
      },
    }),
  ],
});
  • Add the site's Taggor script once; the component appears when it loads.
  • vite.config.ts tells Vue that this tag is not a Vue component.
  • Lists and objects go in as a property of the element, not an attribute.

src/app/stat-counter.component.ts

import { Component, CUSTOM_ELEMENTS_SCHEMA } from "@angular/core";

@Component({
  selector: "app-stat-counter",
  schemas: [CUSTOM_ELEMENTS_SCHEMA],
  template: `
    <stat-counter [still]="true" locale="en" [stats]="values.stats"></stat-counter>
  `,
})
export class StatCounterComponent {
  readonly values = {
    stats: [
      {
        "value": 100,
        "label": "Sites on the Agency plan"
      },
      {
        "value": 24,
        "label": "Months of history on Pro"
      },
      {
        "value": 14,
        "label": "Grace days past a limit"
      }
    ],
  };
}
  • Add the site's Taggor script once; the component appears when it loads.
  • The component declares CUSTOM_ELEMENTS_SCHEMA.
  • Lists and objects go in as a property of the element, not an attribute.

src/TaggorComponent.svelte

<stat-counter
  still
  locale="en"
  stats={[
    {
      "value": 100,
      "label": "Sites on the Agency plan"
    },
    {
      "value": 24,
      "label": "Months of history on Pro"
    },
    {
      "value": 14,
      "label": "Grace days past a limit"
    }
  ]}
></stat-counter>
  • Add the site's Taggor script once; the component appears when it loads.

How an agent gets a component like this onto a site:

taggor checktaggor publish

The CSS variables the component exposes, set the way a customer's page would.

styles.css

stat-counter {
  --sc-radius: 18px;
}

02

Props

Props of the component, read from its manifest
PropTypeDefaultWhat it does
statslistnoneThe numbers: a value, a label, an optional prefix and suffix and decimals.
stillbooleanfalseShows the final numbers at once and never rolls (static previews).
hideSamplebooleanfalseHides the Sample content mark (use it with your own numbers).
localept-BR | enen–

Prop names and descriptions are the component's own, in English, as its author wrote them.

03

Events

This component fires no event.

04

Build one with your agent

Paste this into your agent. It asks you before it signs in, pays or goes further than checking and publishing.

Build me a Taggor component like "Stat counter" (stat-counter): Big numbers that roll up when they come into view. Fetch https://taggor.dev/agent-setup/prompt.md and follow its instructions to set me up for Taggor. Ask me before you sign in, create an account, accept terms, pay for anything or type a secret. Check it with `taggor check` and publish it with `taggor publish`, and stop there. Do not promote it to production, attach it to a site, roll back anything or use --yes, --force or --force-drop-invalid unless I ask for exactly that in this conversation.

05

Related components