# isDirty

> This document is the Markdown version of [formisch.dev/methods/api/isDirty/](https://formisch.dev/methods/api/isDirty/). For the complete documentation index, see [llms.txt](https://formisch.dev/llms.txt).

Checks whether a specific field or the entire form is dirty by walking through the field store and all its descendants. A field is dirty when its input differs from its initial value.

```ts
const dirty = isDirty<TSchema>(form);
const dirty = isDirty<TSchema, TFieldPath>(form, config);
```

## Generics

- `TSchema` `extends FormSchema`
- `TFieldPath` `extends RequiredPath | undefined = undefined`

## Parameters

- `form` `BaseFormStore<TSchema>`
- `config` `IsFormDirtyConfig | IsFieldDirtyConfig<TSchema, TFieldPath> | undefined`

### Explanation

The `form` parameter is the form store to check for dirtiness. The optional `config` parameter scopes the check to a specific field's subtree via a `path` (when omitted, the entire form is checked). The function walks through the field store and all its descendants and returns `true` as soon as it finds a dirty field.

## Returns

- `result` `boolean`

## Related

### Primitives

[`useForm`](/react/api/useForm.md)

### Methods

[`getDirtyInput`](/methods/api/getDirtyInput.md), [`getDirtyPaths`](/methods/api/getDirtyPaths.md), [`pickDirty`](/methods/api/pickDirty.md), [`isTouched`](/methods/api/isTouched.md), [`isEdited`](/methods/api/isEdited.md), [`isValid`](/methods/api/isValid.md)
