All components · Category: Loading and feedback
Success check
A check mark that draws itself, with a burst of confetti.
A badge whose check mark draws itself, with a small confetti burst made in SVG. A button plays it, or your page sets the state. With reduced motion the check simply appears.
01
Try it
Props
Generated from the component's manifest and the values above.
index.html
<success-check state="success" locale="en"></success-check>
<script>
const element = document.querySelector("success-check");
element.addEventListener("success-check:success", (event) => {
console.log(event.detail);
});
</script>
- Add the site's Taggor script once; the component appears when it loads.
taggor-component.js
const element = document.createElement("success-check");
element.setAttribute("state", "success");
element.setAttribute("locale", "en");
element.addEventListener("success-check:success", (event) => {
console.log(event.detail);
});
document.body.append(element);
- Add the site's Taggor script once; the component appears when it loads.
SuccessCheck.tsx
import { useEffect, useRef } from "react";
export function SuccessCheck() {
const ref = useRef<HTMLElement>(null);
useEffect(() => {
const element = ref.current;
if (!element) return;
const onSuccess = (event: Event) => {
console.log((event as CustomEvent).detail);
};
element.addEventListener("success-check:success", onSuccess);
return () => {
element.removeEventListener("success-check:success", onSuccess);
};
}, []);
return <success-check ref={ref} state="success" 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.
- The event is heard with addEventListener, inside an effect.
SuccessCheck.tsx
import { useEffect, useRef } from "react";
export function SuccessCheck() {
const ref = useRef<HTMLElement>(null);
useEffect(() => {
const element = ref.current;
if (!element) return;
const onSuccess = (event: Event) => {
console.log((event as CustomEvent).detail);
};
element.addEventListener("success-check:success", onSuccess);
return () => {
element.removeEventListener("success-check:success", onSuccess);
};
}, []);
return <success-check ref={ref} state="success" 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.
- The event is heard with addEventListener, inside an effect.
src/SuccessCheck.vue
<script setup lang="ts">
function onSuccess(event: Event) {
console.log((event as CustomEvent).detail);
}
</script>
<template>
<success-check
state="success"
locale="en"
@success-check:success="onSuccess"
/>
</template>
vite.config.ts
import vue from "@vitejs/plugin-vue";
import { defineConfig } from "vite";
export default defineConfig({
plugins: [
vue({
template: {
compilerOptions: {
isCustomElement: (tag) => tag === "success-check",
},
},
}),
],
});
- 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.
src/app/success-check.component.ts
import { afterNextRender, Component, CUSTOM_ELEMENTS_SCHEMA, DestroyRef, ElementRef, inject } from "@angular/core";
@Component({
selector: "app-success-check",
schemas: [CUSTOM_ELEMENTS_SCHEMA],
template: `
<success-check state="success" locale="en"></success-check>
`,
})
export class SuccessCheckComponent {
constructor() {
const host = inject<ElementRef<HTMLElement>>(ElementRef);
const element = () => host.nativeElement.querySelector("success-check");
const onSuccess = (event: Event) => {
console.log((event as CustomEvent).detail);
};
afterNextRender(() => element()?.addEventListener("success-check:success", onSuccess));
inject(DestroyRef).onDestroy(() => element()?.removeEventListener("success-check:success", onSuccess));
}
}
- Add the site's Taggor script once; the component appears when it loads.
- The component declares CUSTOM_ELEMENTS_SCHEMA.
- The event is heard with addEventListener, inside an effect.
src/TaggorComponent.svelte
<script>
function onSuccess(event) {
console.log(event.detail);
}
</script>
<success-check state="success" locale="en" onsuccess-check:success={onSuccess}></success-check>
- 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 publishThe CSS variables the component exposes, set the way a customer's page would.
styles.css
success-check {
--sc-radius: 20px;
}02
Props
| Prop | Type | Default | What it does |
|---|---|---|---|
| state | idle | success | idle | Set to success to draw the check; back to idle to reset it. |
| headline | string | none | Replaces the success headline. |
| message | string | none | Replaces the success message. |
| hideConfetti | boolean | false | Draws the check alone, with no confetti. |
| pieces | number 6 to 32 | 16 | How many confetti pieces. |
| hideButton | boolean | false | Hides the button; the page drives it by state. |
| accent | color | none | Badge color; wins over the --sc-accent variable. |
| locale | pt-BR | en | en | – |
Prop names and descriptions are the component's own, in English, as its author wrote them.
03
Events
| Event | When it fires |
|---|---|
| success | The check started to draw. |
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 "Success check" (success-check): A check mark that draws itself, with a burst of confetti.
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
- Feedback collector<feedback-collector>
- Launch countdown<launch-countdown>
- Quick poll<quick-poll>