Skip to Content

Vue, Svelte and others

The widget is a standard custom element, so it works in every framework without a wrapper.

<whocoming-rsvp> is a custom element. Every framework that renders HTML can render it. Load the script once, then use the tag like any other.

<script async src="https://cdn.whocoming.com/embed.js"></script>

Vue

Tell Vue the tag is not a Vue component, so it does not warn:

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

export default defineConfig({
  plugins: [
    vue({
      template: { compilerOptions: { isCustomElement: (tag) => tag === "whocoming-rsvp" } },
    }),
  ],
});
Rsvp.vue
<template>
  <whocoming-rsvp :event="eventId" @whocoming:rsvp="onRsvp" />
</template>

<script setup lang="ts">
defineProps<{ eventId: string }>();

function onRsvp(event: CustomEvent<{ rsvp_id: string; status: string }>) {
  console.log("RSVP", event.detail.rsvp_id, event.detail.status);
}
</script>

Svelte

Rsvp.svelte
<script lang="ts">
  let { eventId }: { eventId: string } = $props();
  let element: HTMLElement;

  $effect(() => {
    const onRsvp = (event: Event) => {
      const { rsvp_id, status } = (event as CustomEvent).detail;
      console.log("RSVP", rsvp_id, status);
    };
    element.addEventListener("whocoming:rsvp", onRsvp);
    return () => element.removeEventListener("whocoming:rsvp", onRsvp);
  });
</script>

<whocoming-rsvp bind:this={element} event={eventId}></whocoming-rsvp>

The event name contains a colon, so listen with addEventListener rather than an on... attribute.

Astro

src/components/Rsvp.astro
---
const { eventId } = Astro.props;
---
<script is:inline async src="https://cdn.whocoming.com/embed.js"></script>
<whocoming-rsvp event={eventId}></whocoming-rsvp>

Angular

Add CUSTOM_ELEMENTS_SCHEMA to the component that uses the tag:

rsvp.component.ts
import { Component, CUSTOM_ELEMENTS_SCHEMA, Input } from "@angular/core";

@Component({
  selector: "app-rsvp",
  standalone: true,
  schemas: [CUSTOM_ELEMENTS_SCHEMA],
  template: `<whocoming-rsvp [attr.event]="eventId"></whocoming-rsvp>`,
})
export class RsvpComponent {
  @Input({ required: true }) eventId!: string;
}

Anything else

Squarespace (Code block), Wix (Embed HTML), Framer (Embed), Ghost (HTML card), Shopify (Custom Liquid section) and plain server templates all take the same two lines. If a builder strips script tags, use the iframe.

When the element's attributes change (for example a different event), the widget updates in place. Removing the element from the page tears it down.

On this page