@using MudBlazor

<MudDialog>
    <DialogContent>
        <MudTextField @bind-Value="SearchTerm"
                      Label="Recherche"
                      Variant="Variant.Outlined"
                      FullWidth="true" />

        <MudButton Variant="Variant.Filled"
                   Color="Color.Primary"
                   Class="mt-2"
                   OnClick="Submit">
            Rechercher
        </MudButton>
    </DialogContent>
</MudDialog>

@code {
    private string SearchTerm { get; set; } = "";

    [Parameter] public EventCallback<string> OnSearch { get; set; }

    [CascadingParameter] IMudDialogInstance Dialog { get; set; }

    private async Task Submit()
    {
        if (OnSearch.HasDelegate)
            await OnSearch.InvokeAsync(SearchTerm);

        Dialog?.Close(DialogResult.Ok(SearchTerm)); // IMPORTANT
    }
}