Documentation feedback

Collect feedback on docs and help articles.

Fields

Page or articletextrequiredWas this page helpful?selectEmail (optional)emailWhat can we improve?textarearequired

Code

import { useState } from "react";

export function DocumentationFeedbackForm() {
  const [sent, setSent] = useState(false);

  async function onSubmit(e: React.FormEvent<HTMLFormElement>) {
    e.preventDefault();
    const form = e.currentTarget;
    const res = await fetch("https://formward.eu/f/your-form-id", {
      method: "POST",
      headers: { Accept: "application/json" },
      body: new FormData(form),
    });
    if (res.ok) {
      setSent(true);
      form.reset();
    }
  }

  if (sent) return <p>Thanks! Your message has been sent.</p>;

  return (
    <form onSubmit={onSubmit}>
      <label htmlFor="page">Page or article</label>
      <input type="text" name="page" id="page" required />
      <label htmlFor="helpful">Was this page helpful?</label>
      <select name="helpful" id="helpful">
        <option value="Yes">Yes</option>
        <option value="Somewhat">Somewhat</option>
        <option value="No">No</option>
      </select>
      <label htmlFor="email">Email (optional)</label>
      <input type="email" name="email" id="email" />
      <label htmlFor="comments">What can we improve?</label>
      <textarea name="comments" id="comments" required />
      <input
        type="text"
        name="_gotcha"
        tabIndex={-1}
        autoComplete="off"
        style={{ position: "absolute", left: "-9999px" }}
        aria-hidden="true"
      />
      <button type="submit">Send</button>
    </form>
  );
}

Use this with Formward

Create a form, copy your endpoint, and replace https://formward.eu/f/your-form-id in the code above.

Documentation feedback template, copy-paste code | Formward