Skip to content

Commit 4906c06

Browse files
Form autoComplete (#137)
Added form auto complete feature
1 parent fea0ed9 commit 4906c06

2 files changed

Lines changed: 12 additions & 0 deletions

File tree

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [Unreleased]
99

10+
### Added
11+
12+
- property `autoComplete` to `Form` component
13+
1014
## [3.6.1] - 2025-06-25
1115

1216
### Fixed

src/lib/Form.tsx

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,12 @@ interface FormProps<T extends FieldValues> {
5151
* hide the validation messages for all form inputs.
5252
*/
5353
hideValidationMessages?: boolean;
54+
55+
/**
56+
* controls browser autocomplete behavior for the form.
57+
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/autocomplete
58+
*/
59+
autoComplete?: string;
5460
}
5561

5662
const Form = <T extends FieldValues>({
@@ -63,6 +69,7 @@ const Form = <T extends FieldValues>({
6369
autoSubmitConfig,
6470
formRef,
6571
hideValidationMessages = false,
72+
autoComplete,
6673
}: FormProps<T>) => {
6774
const revivedDefaultValues = defaultValues
6875
? (JSON.parse(JSON.stringify(defaultValues), jsonIsoDateReviver) as DeepPartial<T>)
@@ -81,6 +88,7 @@ const Form = <T extends FieldValues>({
8188
}}
8289
onSubmit={autoSubmitHandler}
8390
method="POST"
91+
autoComplete={autoComplete}
8492
>
8593
{children instanceof Function ? children({ ...formMethods, disabled, requiredFields, hideValidationMessages }) : children}
8694
</form>

0 commit comments

Comments
 (0)