# `reset` & `resetField`

> The defaults are the destination: `reset` for the whole form, `resetField` for one path. Both wipe state along with values.


Type into any field to flip it dirty. Click `resetField` to restore one path; click `reset()` to restore everything; click `reset(newDefaults)` to redirect the defaults AND restore in one call. The dirty markers and the form-level pristine/dirty status update reactively as state reset propagates.


## `reset()` restores defaults

```ts
form.reset()
```

Every path goes back to its `defaultValues` entry, or, where no override was given, to the schema-slim default (`''` for strings, `0` for numbers, `false` for booleans). Alongside the value reset:

- `dirty` flips false on every leaf.
- `touched` flips false on every leaf.
- `errors` clear at every path.
- `meta.submissionAttempts`, `meta.submitted`, and `meta.submitError` all zero (the submission surface returns to its initial state).

`reset()` is the right call after a successful submit when you want the form to look fresh, or when a "Discard changes" button needs to back out unsaved edits.

## `reset(nextDefaults)` redirects defaults

Pass a new defaults object to update the form's defaults AND reset in one step:

```ts
form.reset({ name: 'New Default', email: 'new@example.com' })
```

After this call, the new object IS the form's defaults for any subsequent `reset()` or `resetField` call. Useful when the form needs to switch contexts: editing record A then loading record B's values as the new baseline.

The argument is a `DefaultValuesInput<Form>`, which is already optional at every key, all the way down. Keys you don't mention keep the previous defaults at whatever depth you stop: `form.reset({ profile: { city: 'Ndola' } })` re-seats `profile.city` and leaves `profile.zip` on its old default rather than dropping it. Pass `{}` to reset with no changes to the defaults.

Arrays are replaced wholesale rather than merged element-wise, so `form.reset({ tags: ['x'] })` leaves one tag, not four. To withdraw a value instead of changing it, pass [`unset`](/docs/writing-and-mutating/unset) at that path.

### Save, then discard

This is the shape most forms that save end up in. After a successful save, the values on screen should be what actually persisted, so reset from the resource the server returned:

```ts
const schema = z.object({ city: z.string(), state: z.string() })
const form = useForm({ schema, defaultValues: address })

async function save() {
  const saved = await api.updateAddress(form.values())
  form.reset(toValues(saved))
}
```

Discard is then the plain `form.reset()`, with nothing to track on your side:

```ts
const discard = () => form.reset()
```

Because `reset(nextDefaults)` re-seats the defaults, Discard returns to the last save. It does not roll back across it, and `dirty` stays honest against the saved values, so an unsaved-changes bar appears exactly when there is something to save.

### Defaults that arrive late

A function-form `defaultValues` resolves the same way. Whatever the factory returns becomes the form's defaults, so `form.reset()` lands on the fetched resource, and a form is pristine the moment its data arrives:

```ts
const form = useForm({ schema, defaultValues: () => api.getAddress(id) })
```

`form.rehydrate()` re-seats them again with the refetched values. See [async defaults](/docs/schemas/defaults).

## `resetField(path)` restores one path

```ts
form.resetField('email')
```

Same semantics as `reset()`, scoped to a single path:

- Value goes back to the path's default.
- `dirty` and `touched` flip false at that path.
- Errors at that path clear.

Useful when one field's been edited but the user wants to discard just that change while keeping the rest of the form's edits in place.

## Reset vs clear

`reset` and `resetField` go to **defaults**. [`clear`](/docs/writing-and-mutating/clear) goes to **blank**: the schema-slim empty value, skipping defaults. Pick reset when "back to baseline" is the goal; pick clear when "wipe to zero" is.

## Where to next

- [`setValue` patterns](/docs/writing-and-mutating/set-value): write specific values without going through defaults.
- [`clear`](/docs/writing-and-mutating/clear): wipe to blank values, defaults intentionally skipped.
- [Submit lifecycle](/docs/submitting/handle-submit): handlers that pair reset with successful submits.
