Usage
Prevent accidental navigation loss by showing a confirmation when users leave a page.
Use Disabled to enable protection conditionally, and UseNativePrompt to choose between MudBlazor and browser-native prompts.
<MudExitPrompt Disabled="_isDisabled" UseNativePrompt="_useNativePrompt"/> <MudStack Spacing="2"> <MudSwitch Label="Disabled" @bind-Value="_isDisabled" Color="Color.Primary"/> <MudSwitch Label="Use native prompt" @bind-Value="_useNativePrompt" Color="Color.Primary"/> <MudButton Variant="Variant.Outlined" Color="Color.Primary" Href="/components/exitprompt">Test navigation</MudButton> </MudStack>
@code { private bool _isDisabled; private bool _useNativePrompt; }