Dev Helpers
← Back

Catalog sort form

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

Open this example in the interactive library

Source code

// components/CatalogSortForm.tsx

import Form from "next/form";

export default function CatalogSortForm({
  action = "/search",
}: { action?: string } = {}) {
  return (
    <Form action={action} scroll={false}>
      <label>
        Sort by
        <select name="sort">
          <option value="new">Newest</option>
          <option value="price">Price</option>
        </select>
      </label>
      <button>Reorder</button>
    </Form>
  );
}