how to change font family of sweetalert

22,298

Solution 1

Configuration options are listed here. They do not appear to include an option for changing the font.

However, all of the elements involved in the SweetAlert popup have SweetAlert-specific classes so you should be able to set the fonts via CSS. Some key classes and examples are listed in the SweetAlert docs under Theming.

Solution 2

Add this to the css!

.swal2-popup {
  font-size: 1.6rem !important;
  font-family: Georgia, serif;
}
Share:
22,298

Related videos on Youtube

farshid azizi
Author by

farshid azizi

Updated on June 09, 2021

Comments

  • farshid azizi
    farshid azizi about 3 years

    How can I change the font family in sweetalert? Thank You

    swal({
                title: "Are you sure?",
                text: "Your will not be able to recover this imaginary file!",
                type: "warning",
                showCancelButton: true,
                confirmButtonColor: "#DD6B55",
                confirmButtonText: "Yes, delete it!",
                cancelButtonText: "No, cancel plx!",
                closeOnConfirm: false,
                closeOnCancel: false
            },
    
    • Rory McCrossan
      Rory McCrossan almost 5 years
      Change the CSS rule for the alert.
  • Bishwas
    Bishwas about 3 years
    The user is asking about the font family. Not font size.
  • Arun P
    Arun P about 3 years
    I have updated the answer, its just to add the style for the same class