All components · Category: Calculators
Quote wizard
Four steps, a live estimate and a request for a quote.
Walks a visitor through the project, the extras and a rush option, shows an estimate along the way and sends the request with consent.
01
Try it
Props
Generated from the component's manifest and the values above.
index.html
<quote-wizard currency="USD" locale="en"></quote-wizard>
<script>
const element = document.querySelector("quote-wizard");
element.addEventListener("quote-wizard:step", (event) => {
console.log(event.detail);
});
element.addEventListener("quote-wizard:submitted", (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("quote-wizard");
element.setAttribute("currency", "USD");
element.setAttribute("locale", "en");
element.addEventListener("quote-wizard:step", (event) => {
console.log(event.detail);
});
element.addEventListener("quote-wizard:submitted", (event) => {
console.log(event.detail);
});
document.body.append(element);
- Add the site's Taggor script once; the component appears when it loads.
QuoteWizard.tsx
import { useEffect, useRef } from "react";
export function QuoteWizard() {
const ref = useRef<HTMLElement>(null);
useEffect(() => {
const element = ref.current;
if (!element) return;
const onStep = (event: Event) => {
console.log((event as CustomEvent).detail);
};
element.addEventListener("quote-wizard:step", onStep);
const onSubmitted = (event: Event) => {
console.log((event as CustomEvent).detail);
};
element.addEventListener("quote-wizard:submitted", onSubmitted);
return () => {
element.removeEventListener("quote-wizard:step", onStep);
element.removeEventListener("quote-wizard:submitted", onSubmitted);
};
}, []);
return <quote-wizard ref={ref} currency="USD" 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.
QuoteWizard.tsx
import { useEffect, useRef } from "react";
export function QuoteWizard() {
const ref = useRef<HTMLElement>(null);
useEffect(() => {
const element = ref.current;
if (!element) return;
const onStep = (event: Event) => {
console.log((event as CustomEvent).detail);
};
element.addEventListener("quote-wizard:step", onStep);
const onSubmitted = (event: Event) => {
console.log((event as CustomEvent).detail);
};
element.addEventListener("quote-wizard:submitted", onSubmitted);
return () => {
element.removeEventListener("quote-wizard:step", onStep);
element.removeEventListener("quote-wizard:submitted", onSubmitted);
};
}, []);
return <quote-wizard ref={ref} currency="USD" 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/QuoteWizard.vue
<script setup lang="ts">
function onStep(event: Event) {
console.log((event as CustomEvent).detail);
}
function onSubmitted(event: Event) {
console.log((event as CustomEvent).detail);
}
</script>
<template>
<quote-wizard
currency="USD"
locale="en"
@quote-wizard:step="onStep"
@quote-wizard:submitted="onSubmitted"
/>
</template>
vite.config.ts
import vue from "@vitejs/plugin-vue";
import { defineConfig } from "vite";
export default defineConfig({
plugins: [
vue({
template: {
compilerOptions: {
isCustomElement: (tag) => tag === "quote-wizard",
},
},
}),
],
});
- 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/quote-wizard.component.ts
import { afterNextRender, Component, CUSTOM_ELEMENTS_SCHEMA, DestroyRef, ElementRef, inject } from "@angular/core";
@Component({
selector: "app-quote-wizard",
schemas: [CUSTOM_ELEMENTS_SCHEMA],
template: `
<quote-wizard currency="USD" locale="en"></quote-wizard>
`,
})
export class QuoteWizardComponent {
constructor() {
const host = inject<ElementRef<HTMLElement>>(ElementRef);
const element = () => host.nativeElement.querySelector("quote-wizard");
const onStep = (event: Event) => {
console.log((event as CustomEvent).detail);
};
afterNextRender(() => element()?.addEventListener("quote-wizard:step", onStep));
inject(DestroyRef).onDestroy(() => element()?.removeEventListener("quote-wizard:step", onStep));
const onSubmitted = (event: Event) => {
console.log((event as CustomEvent).detail);
};
afterNextRender(() => element()?.addEventListener("quote-wizard:submitted", onSubmitted));
inject(DestroyRef).onDestroy(() => element()?.removeEventListener("quote-wizard:submitted", onSubmitted));
}
}
- 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 onStep(event) {
console.log(event.detail);
}
function onSubmitted(event) {
console.log(event.detail);
}
</script>
<quote-wizard
currency="USD"
locale="en"
onquote-wizard:step={onStep}
onquote-wizard:submitted={onSubmitted}
></quote-wizard>
- 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
quote-wizard {
--qw-radius: 10px;
}02
Props
| Prop | Type | Default | What it does |
|---|---|---|---|
| headline | string | none | Replaces the default heading. |
| accent | color | none | Accent color of the bar, the choices and the buttons. |
| services | list | [{"id":"landing","label":"Landing page","descri… | The projects the visitor can pick (sample prices, set your own). |
| extras | list | [{"id":"copy","label":"Copywriting","price":350… | Optional add-ons; `forService` limits one to a project id. |
| rushPercent | number 0 to 100 | 25 | Surcharge of the rush schedule; 0 hides the option. |
| currency | USD | EUR | BRL | USD | – |
| hideEstimate | boolean | false | Leaves every price out of the screens. |
| privacyPolicy | url | none | Link to the site's privacy policy. |
| 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 |
|---|---|
| step | The visitor moved to another step. |
| submitted | The quote request was accepted by Taggor. |
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 "Quote wizard" (quote-wizard): Four steps, a live estimate and a request for a quote.
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
- Budget calculator<budget-calculator>
- Lead form<contact-form>
- Pricing configurator<pricing-configurator>