docs: adds sections on resetting a form and interactionState (#2246)

* docs: ✏️ adds section on resetting a form and interactionState

* chore: ran formatting
This commit is contained in:
Robin Van Roy 2024-04-09 11:33:16 +02:00 committed by GitHub
parent d2edadd3b0
commit efcd4bf15b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 15 additions and 0 deletions

View file

@ -175,3 +175,9 @@ export const feedbackVisibility = () => html`
></lion-input-date>
`;
```
## Resetting
In some situations, resetting the interaction state might be desired, e.g., to clear an entire form or a single input field from errors.
In those cases, using the `resetInteractionState` on a field or a form resets its respective interaction state without resetting the modelValue.

View file

@ -33,3 +33,12 @@ For more information about parsing and the Unparseable type, see [Formatting and
element' (for instance a lion-input) to a top element (for instance lion-form). An example path
could be [lionForm, lionFieldset, lionInput]
- `initialize`: whether this is the first time the event is fired (on first render of the FormControl)
### Resetting
Resetting a form can be done by two different methods.
- `resetGroup()`: resets every form field to its initial/prefilled value and interaction state
- `clearGroup()`: clears every form field, disregarding its initial/prefilled value and interaction state
Both methods do so by calling `reset|resetGroup` or `clear|clearGroup` on each `LionField` found in the form.