Open this example in the interactive library
Source code
// components/DateRangeRouteForm.tsx
import Form from "next/form";
export default function DateRangeRouteForm({
action = "/search",
}: { action?: string } = {}) {
return (
<Form action={action}>
<label>
From
<input name="from" type="date" />
</label>
<label>
Through
<input name="to" type="date" />
</label>
<button>Show range</button>
</Form>
);
}
