Submit JSON with Svelte

Use the Submit JSON JS Client to wire up a contact us form submission notification using Svelte.

Set up your Svelte project

  1. To get started, make sure you have a working Svelte project. If you do not, follow these instructions.
  2. Then install submitjson with your favorite package manager.
pnpm add submitjson # OR npm i OR yarn add

Integrate Submit JSON with Svelte

Next initialize the client and handle the contact us form submission in your Svelte component:

import SubmitJSON from 'submitjson'

const sj = new SubmitJSON({ apiKey: 'sjk_xxx', endpoint: 'xxx' })

let name = ''
let email = ''
let message = ''

async function submit() {
  await sj.submit({ name, email, message })

<form on:submit|preventDefault={submit}>
  <input type="text" bind:value={name}>
  <input type="email" bind:value={email}>
  <textarea bind:value={message}>

  <button type="submit">

🚛✨💚 Nice job, you successfully integrated Submit JSON with Svelte.