BwDiscardForm | bw-discard-form
Overview
The <bw-discard-form> component is used to show a dialog when a user tries to leave a form with unsaved changes.
Properties
| Property | Attribute | Description | Type | Default |
|---|---|---|---|---|
changed | changed | Whether to show the dialog when the form is changed | boolean | true |
discardText | discard-text | The text to show on the discard button | string | 'Discard' |
form | form | ID of the form to submit the button to. Only use if the button is located outside the form. | string | undefined |
goBackText | go-back-text | The text to show on the go back button | string | 'Go Back' |
header | header | The header to show in the dialog | string | 'Discard draft?' |
message | message | The message to show in the dialog | string | "Any changes you made won't be saved. Are you sure you want to continue?" |
showDialogFn | -- | If you need to do custom logic to decide whether or not the dialog should show, pass a function here that returns true if you want it to display and false otherwise | () => boolean | Promise<boolean> | undefined |
touched | touched | Whether to show the dialog when the form is touched | boolean | true |
Events
| Event | Description | Type |
|---|---|---|
discard | Emitted when the user confirms they want to discard the form | CustomEvent<any> |
Methods
force() => Promise<boolean>
Force the discard prompt flow to begin. It will still do the logic to figure out if it should show or not.
Returns
Type: Promise<boolean>
Slots
| Slot | Description |
|---|---|
| A button that will trigger the discard form dialog. |
Dependencies
Used by
Depends on
Graph
© 2025 United Systems & Software - All Rights Reserved.