Skip to content

FAQ

Questions that open and shut smoothly, with the answers in the page’s HTML.

54 lines · React · Tailwind 4

Install

$ bunx shadcn@latest add @blocco/faq

Code

blocks/free/faq.tsx54 lines
import { ChevronDown } from "@/registry/blocco/ui/icons";

const faqs = [
  {
    q: "Can I use my own domain?",
    a: "Yes. Add a domain on any paid plan, point one DNS record at us, and links on it work within minutes. We issue the certificate for you.",
  },
  {
    q: "What happens to my links if I stop paying?",
    a: "They keep redirecting. Anything over the free plan becomes read-only for 30 days, then the extra links pause. Nothing is deleted.",
  },
  {
    q: "Do you store visitors’ IP addresses?",
    a: "No. We record the country, the referrer, the device and the time of each click, and nothing that identifies a person.",
  },
  {
    q: "Can I move my links from another service?",
    a: "Yes. Import a CSV or connect your old account, and every link keeps its path where the domain allows it.",
  },
];

/**
 * Questions that open and shut smoothly. Native <details>, so the answers
 * are in the page's HTML for search engines and work without JavaScript.
 */
export default function Faq() {
  return (
    <section className="mx-auto grid max-w-6xl gap-10 px-6 py-16 sm:py-24 lg:grid-cols-[minmax(0,1fr)_minmax(0,1.6fr)] lg:gap-16">
      <h2 className="text-3xl font-bold tracking-tight text-balance sm:text-4xl lg:sticky lg:top-24 lg:self-start">
        Questions. <span className="text-muted">Answered before you ask.</span>
      </h2>
      <div className="rounded-2xl bg-surface smooth-shadow-ring-xs">
        {faqs.map((item, i) => (
          <details
            key={item.q}
            className="group px-5 [&:not(:first-child)]:shadow-[inset_0_1px_0_var(--border)]"
            open={i === 0}
          >
            <summary className="flex cursor-pointer list-none items-center justify-between gap-4 py-4 font-semibold [&::-webkit-details-marker]:hidden">
              {item.q}
              <ChevronDown
                size={18}
                aria-hidden
                className="shrink-0 text-muted transition-transform duration-200 group-open:rotate-180"
              />
            </summary>
            <p className="pb-5 text-pretty text-muted">{item.a}</p>
          </details>
        ))}
      </div>
    </section>
  );
}