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:
parent
d2edadd3b0
commit
efcd4bf15b
2 changed files with 15 additions and 0 deletions
|
|
@ -175,3 +175,9 @@ export const feedbackVisibility = () => html`
|
||||||
></lion-input-date>
|
></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.
|
||||||
|
|
|
||||||
|
|
@ -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
|
element' (for instance a lion-input) to a top element (for instance lion-form). An example path
|
||||||
could be [lionForm, lionFieldset, lionInput]
|
could be [lionForm, lionFieldset, lionInput]
|
||||||
- `initialize`: whether this is the first time the event is fired (on first render of the FormControl)
|
- `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.
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue