Skip to main content

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

PropertyAttributeDescriptionTypeDefault
changedchangedWhether to show the dialog when the form is changedbooleantrue
discardTextdiscard-textThe text to show on the discard buttonstring'Discard'
formformID of the form to submit the button to. Only use if the button is located outside the form.stringundefined
goBackTextgo-back-textThe text to show on the go back buttonstring'Go Back'
headerheaderThe header to show in the dialogstring'Discard draft?'
messagemessageThe message to show in the dialogstring"Any changes you made won't be saved. Are you sure you want to continue?"
showDialogFnshow-dialog-fnIf 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
touchedtouchedWhether to show the dialog when the form is touchedbooleantrue

Events

EventDescriptionType
discardEmitted when the user confirms they want to discard the formCustomEvent<any>

Slots

SlotDescription
A button that will trigger the discard form dialog.

© 2025 United Systems & Software - All Rights Reserved.