Dev Helpers

Next.js / GET forms

Search route form

Dev Helpers · January 7, 2026

A GET search form produces a shareable query string. Give the input a name and ensure the results page understands an empty search.

Worked example

// components/SearchRouteForm.tsx

import Form from "next/form";

export default function SearchRouteForm({
  action = "/search",
}: { action?: string } = {}) {
  return (
    <Form action={action}>
      <label>
        Keywords
        <input name="q" type="search" required />
      </label>
      <button>Search</button>
    </Form>
  );
}

Implementation notes

The URL is the durable state of a GET search. Initialize the visible field from that URL so back navigation and page reloads preserve the search.

Try it yourself

Submit accented text and reopen the copied results URL.

Open the Next.js example →

Editorial date January 7, 2026 · Published December 6, 2026

Related articles

Free bin volume

Free storage volume depends on consistent dimensions and units. Derive capacity and usage in the same unit before formatting a human-readable summary.

Draft preview indexing

Draft pages need deliberate indexing metadata. An indexing directive controls crawler intent, while access to unpublished material needs a separate permission check.

Party size allocation

Allocating a party into groups is an integer problem. The remainder determines whether another group is needed and how full it will be.