FnzBootstrapModal.razor 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. @using FNZCM.BlazorWasm.UI.Components.FnzBootstrap.Bases
  2. @inherits FnzBootstrapContainerComponentBase<FnzBootstrapModal,Options>
  3. @code {
  4. [Parameter] public BackdropMode Backdrop { get => _options.Backdrop; set => _options.Backdrop = value; }
  5. [Parameter] public bool Keyboard { get => _options.Keyboard; set => _options.Keyboard = value; }
  6. [Parameter] public bool Focus { get => _options.Focus; set => _options.Focus = value; }
  7. [Parameter] public string CssClass { get; set; }
  8. [Parameter] public RenderFragment Title { get; set; }
  9. [Parameter] public RenderFragment Body { get; set; }
  10. [Parameter] public RenderFragment Footer { get; set; }
  11. [Parameter] public bool ShowCloseButton { get; set; } = true;
  12. protected override string Prefix => base.Prefix + ".modal";
  13. }
  14. <div class="modal fade" id="@ElementId">
  15. <div class="modal-dialog modal-dialog-centered @CssClass" @attributes="@InputAttributes">
  16. <div class="modal-content">
  17. <div class="modal-header align-items-baseline">
  18. <h5 class="modal-title mx-1">@Title</h5>
  19. @if (ShowCloseButton)
  20. {
  21. <button hidd type="button" class="btn-close" @onclick="Hide"></button>
  22. }
  23. </div>
  24. <div class="modal-body">
  25. @Body
  26. </div>
  27. <div class="modal-footer">
  28. @if (Footer == null)
  29. {
  30. if (ShowCloseButton)
  31. {
  32. <button class="btn btn-primary" @onclick="Hide">Close</button>
  33. }
  34. }
  35. else
  36. {
  37. @Footer
  38. }
  39. </div>
  40. </div>
  41. </div>
  42. </div>