rembrembdocs

Form

Last updated April 23, 2026

The <Form> component extends the HTML <form> element to provide client-side navigation on submission, and progressive enhancement.

It's useful for forms that update URL search params as it reduces the boilerplate code needed to achieve the above.

Basic usage:

/ui/search.js

JavaScriptTypeScript

import Form from 'next/form'
 
export default function Page() {
  return (
    <Form action="/search">
      {/* On submission, the input value will be appended to
          the URL, e.g. /search?query=abc */}
      <input name="query" />
      <button type="submit">Submit</button>
    </Form>
  )
}

Reference

The behavior of the <Form> component depends on whether the action prop is passed a string or function.

action (string) Props

When action is a string, the <Form> component supports the following props:

PropExampleTypeRequired
actionaction="/search"string (URL or relative path)Yes
replacereplace={false}boolean-
scrollscroll={true}boolean-

Caveats

Was this helpful?