Taggor

All components · Category: Maps and places

Store locator

A stylized map with filters, pulsing pins and a synced list.

Filter chips, pins that pulse and a list that stays in sync: choose a place on the map or in the list and both light up. The map is drawn in code, with no map tiles, no third party and no geolocation. The places come from props and are marked as sample content until you pass your own.

01

Try it

<store-locator>
View

Props

Accent
Corners
store-locator: A stylized map with filters, pulsing pins and a synced list. 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

<store-locator locale="en"></store-locator>

<script>
  const element = document.querySelector("store-locator");
  element.addEventListener("store-locator:select", (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("store-locator");
element.setAttribute("locale", "en");
element.addEventListener("store-locator:select", (event) => {
  console.log(event.detail);
});
document.body.append(element);
  • Add the site's Taggor script once; the component appears when it loads.

StoreLocator.tsx

import { useEffect, useRef } from "react";

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

  useEffect(() => {
    const element = ref.current;
    if (!element) return;
    const onSelect = (event: Event) => {
      console.log((event as CustomEvent).detail);
    };
    element.addEventListener("store-locator:select", onSelect);
    return () => {
      element.removeEventListener("store-locator:select", onSelect);
    };
  }, []);

  return <store-locator ref={ref} 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.

StoreLocator.tsx

import { useEffect, useRef } from "react";

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

  useEffect(() => {
    const element = ref.current;
    if (!element) return;
    const onSelect = (event: Event) => {
      console.log((event as CustomEvent).detail);
    };
    element.addEventListener("store-locator:select", onSelect);
    return () => {
      element.removeEventListener("store-locator:select", onSelect);
    };
  }, []);

  return <store-locator ref={ref} 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/StoreLocator.vue

<script setup lang="ts">
function onSelect(event: Event) {
  console.log((event as CustomEvent).detail);
}
</script>

<template>
  <store-locator locale="en" @store-locator:select="onSelect" />
</template>

vite.config.ts

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

export default defineConfig({
  plugins: [
    vue({
      template: {
        compilerOptions: {
          isCustomElement: (tag) => tag === "store-locator",
        },
      },
    }),
  ],
});
  • 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/store-locator.component.ts

import { afterNextRender, Component, CUSTOM_ELEMENTS_SCHEMA, DestroyRef, ElementRef, inject } from "@angular/core";

@Component({
  selector: "app-store-locator",
  schemas: [CUSTOM_ELEMENTS_SCHEMA],
  template: `
    <store-locator locale="en"></store-locator>
  `,
})
export class StoreLocatorComponent {
  constructor() {
    const host = inject<ElementRef<HTMLElement>>(ElementRef);
    const element = () => host.nativeElement.querySelector("store-locator");
    const onSelect = (event: Event) => {
      console.log((event as CustomEvent).detail);
    };
    afterNextRender(() => element()?.addEventListener("store-locator:select", onSelect));
    inject(DestroyRef).onDestroy(() => element()?.removeEventListener("store-locator:select", onSelect));
  }
}
  • 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 onSelect(event) {
    console.log(event.detail);
  }
</script>

<store-locator locale="en" onstore-locator:select={onSelect}></store-locator>
  • 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

store-locator {
  --sl-radius: 16px;
}

02

Props

Props of the component, read from its manifest
PropTypeDefaultWhat it does
storeslistnoneThe places: a name, a kind (store, pickup, service), x and y as percentages of the map, optional city and hours.
hideSamplebooleanfalseHides the Sample content mark (use it with your own places).
localept-BR | enen–

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

03

Events

Events of the component, read from its manifest
EventWhen it fires
selectThe visitor chose a place, by pin or by list.

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 "Store locator" (store-locator): A stylized map with filters, pulsing pins and a synced list. 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