Dev Helpers
← Back

Facet checkbox route form

Place this file at components/FacetCheckboxRouteForm.tsx in an App Router project.

Open this example in the interactive library

Source code

// components/FacetCheckboxRouteForm.tsx

import Form from "next/form";

export default function FacetCheckboxRouteForm({
  action = "/search",
}: { action?: string } = {}) {
  return (
    <Form action={action}>
      <fieldset>
        <legend>Material</legend>
        {["oak", "steel", "glass"].map((v) => (
          <label key={v}>
            <input type="checkbox" name="tag" value={v} />
            {v}
          </label>
        ))}
      </fieldset>
      <button>Apply</button>
    </Form>
  );
}