FAQ section

Common questions grouped by topic. A sliding pill picks the topic, and each question in the card opens its answer underneath, one at a time.

Questions, answered

The things people ask before they sign up, grouped by topic.

It keeps your projects, files and feedback in one place, so the team and the client always look at the same thing.

Small studios and freelancers who run a handful of client projects at a time and are tired of chasing email threads.

Yes. Every plan starts with 14 days free, and you do not need a card to begin.

Options

Screen
Colour

Code

import { useId, useState } from "react";
import "./faq-section.css";

const topics = [
  {
    name: "General",
    questions: [
      { q: "What does Logoipsum do?", a: "It keeps your projects, files and feedback in one place, so the team and the client always look at the same thing." },
      { q: "Who is it for?", a: "Small studios and freelancers who run a handful of client projects at a time and are tired of chasing email threads." },
      { q: "Can I try it before paying?", a: "Yes. Every plan starts with 14 days free, and you do not need a card to begin." },
    ],
  },
  {
    name: "Billing",
    questions: [
      { q: "How does billing work?", a: "You pay per member, monthly or yearly. Clients you invite to a project are always free." },
      { q: "Can I change plan later?", a: "At any time, from Settings. Moving up takes effect straight away, and moving down applies from your next bill." },
      { q: "Do you offer refunds?", a: "If something is not right in the first 30 days, write to us and we will refund the payment in full." },
    ],
  },
  {
    name: "Support",
    questions: [
      { q: "How do I get help?", a: "Write to [email protected]. A person answers within one working day, and usually much sooner." },
      { q: "Where is my data kept?", a: "On servers in the EU, backed up every night. You can ask us to delete it for good whenever you like." },
      { q: "Can I export my work?", a: "Yes. Any project can be downloaded as a zip of its files with the comments in a spreadsheet." },
    ],
  },
];

/* One question. Its answer stays in the page while closed, so it can open
   with a transition, and is inert so it cannot be tabbed into. */
function Question({ q, a, open, onToggle }) {
  const id = useId();
  return (
    <div className="dh-faq-item">
      <h3>
        <button type="button" aria-expanded={open} aria-controls={id} onClick={onToggle}>
          {q}
          <svg viewBox="0 0 16 16" aria-hidden="true">
            <path d="M8 3.5v9" />
            <path d="M3.5 8h9" />
          </svg>
        </button>
      </h3>
      <div className="dh-faq-answer" id={id} role="region" inert={!open}>
        <p>{a}</p>
      </div>
    </div>
  );
}

/* <FaqSection title="Questions, answered" topics={[{ name: "General", questions: [{ q: "…", a: "…" }] }]} /> */
export function FaqSection({
  title = "Questions, answered",
  text = "The things people ask before they sign up, grouped by topic.",
  email = "[email protected]",
  topics: list = topics,
}) {
  const id = useId();
  const [at, setAt] = useState(0);
  const [open, setOpen] = useState(0);

  const choose = (index) => {
    setAt(index);
    setOpen(0);
  };

  /* The arrow keys move between topics, as they do in any set of tabs. */
  const onKeyDown = (event) => {
    const last = list.length - 1;
    const next = { ArrowRight: at === last ? 0 : at + 1, ArrowLeft: at === 0 ? last : at - 1, Home: 0, End: last }[event.key];
    if (next === undefined) return;
    choose(next);
    event.currentTarget.children[next].focus();
  };

  return (
    <section className="dh-faq">
      <div className="dh-faq-inner">
        <header className="dh-faq-head">
          <h2>{title}</h2>
          <p>{text}</p>
        </header>
        <div className="dh-faq-tabs" role="tablist" aria-label="Topics" style={{ "--count": list.length, "--at": at }} onKeyDown={onKeyDown}>
          {list.map((topic, index) => (
            <button
              type="button"
              role="tab"
              key={topic.name}
              id={id + "tab" + index}
              aria-controls={id + "panel"}
              aria-selected={index === at}
              tabIndex={index === at ? 0 : -1}
              onClick={() => choose(index)}
            >
              {topic.name}
            </button>
          ))}
        </div>
        <aside className="dh-faq-help">
          <p>
            <b>Not here?</b> Write to us and a person will reply within a working day.
          </p>
          <a href={"mailto:" + email}>{email}</a>
        </aside>
        {/* The key makes the list fade in again when the topic changes. */}
        <div className="dh-faq-panel" role="tabpanel" id={id + "panel"} aria-labelledby={id + "tab" + at} key={at}>
          {list[at].questions.map((item, index) => (
            <Question key={item.q} {...item} open={index === open} onToggle={() => setOpen(index === open ? -1 : index)} />
          ))}
        </div>
      </div>
    </section>
  );
}

export function Example() {
  return <FaqSection />;
}

Questions, answered

The things people ask before they sign up, grouped by topic.

It keeps your projects, files and feedback in one place, so the team and the client always look at the same thing.

Small studios and freelancers who run a handful of client projects at a time and are tired of chasing email threads.

Yes. Every plan starts with 14 days free, and you do not need a card to begin.