r/javascript • • Nov 13 '19

SweetAlert2 - a beautiful, responsive, highly customizable and accessible (WAI-ARIA) replacement for JavaScript's popup boxes (alert, prompt, dialog, toast, side panel, etc.)

https://sweetalert2.github.io/
255 Upvotes

28 comments sorted by

28

u/limonmonte Nov 13 '19

Many of you already know about SweetAlert2, I'm sharing it again here because we recently shipped the new major release v9.0.0 with better customization (new showClass and hideClass params, progress bar for timer) and themes:

All themes can be viewed here: https://sweetalert2.github.io/ (the theme switcher is in the left sidebar)

See the release notes for all changes: https://github.com/sweetalert2/sweetalert2/releases/tag/v9.0.0

Read more about SweetAlert2 themes: https://github.com/sweetalert2/sweetalert2-themes

8

u/blazedd Nov 14 '19

Love the Dark theme! Would you intertain a PR to fix some of the leftovers from the light theme like the focus and footer border:

Example: https://imgur.com/a/0soCHYD

4

u/limonmonte Nov 14 '19

Fixed, thanks for reporting! http://i.imgur.com/8rKeHri.png

2

u/evenisto Nov 14 '19

Wow, the timing couldn't be better, exactly when I needed a bootstrap theme! Thanks a lot

1

u/tvfriend888 Nov 18 '19

Looks fantastic.
I would love to see Tailwind support added. I think there'd be enough interest in it.

0

u/[deleted] Nov 14 '19

[deleted]

1

u/limonmonte Nov 14 '19

I added the side panel with a switcher for mobile layout, the side panel is also implemented with SweetAlert2 :)

1

u/elingeniero Nov 14 '19

Works as intended!

18

u/sdiown Nov 14 '19

You changed the fire action 1000 times, what the heck. In every release you are changing the name of firing function and it's parameters. Not good...

1

u/Aswole Nov 14 '19

I think it's ok if the changes are made across major versions, but if they are changing the API incrementally... Yikes

2

u/limonmonte Nov 14 '19

We are strictly following the semver and breaking changes are present only in major releases. Also, we are mostly deprecating API params and methods before removing/changing them and notifying users about deprecations.

4

u/imbk_dev Nov 13 '19

I love it, it looks awesome.

One problem I had on my phone (latest chrome, android) is that the page is not responsive for a second or two after the pop-up closes. Please check that out.

3

u/limonmonte Nov 14 '19

That's the bug in the current (78) and next (79) versions of Chrome on Android. They fixed it in 80, you can install Chrome Dev and verify that all is working smoothly there.

Funny enough all is well in all other desktop and mobile browsers including Brave on Android which is also Chromium-based browser, so I suspect that Google devs made some rendering "optimization" which causes this issue.

2

u/Notuana Nov 14 '19

Nice! On mobile the nyan cat is hidden behind the box :(

2

u/limonmonte Nov 14 '19

Fixed, thanks for reporting this critical issue! :)

2

u/tbranyen Nov 14 '19

Looks really nice, will have to dig into the config to see if you can disable the scrollbar hiding. I don't like seeing my page shift every time I click.

This was developed using a Mac I bet.

2

u/limonmonte Nov 14 '19

> Looks really nice, will have to dig into the config to see if you can disable the scrollbar hiding. I don't like seeing my page shift every time I click.

The page shouldn't shift as we're measuring the scrollbar and adding the body padding when a modal is shown. Could you provide more details about the issue you're facing? https://github.com/sweetalert2/sweetalert2/issues

Thanks in advance!

12

u/[deleted] Nov 14 '19

This is amazing work, thank you. I’ve always avoided modals because they are sort of a pain in the ass to implement, and no pre-rolled solution has really hit all the marks for me. But these are just... delightful. I want to use them excessively.

6

u/tristan957 Nov 13 '19

Nice examples. Really easy to use

4

u/barelylogic Nov 13 '19

Looks great! And really good examples showing various uses. One to remember for my future projects. Thanks for sharing!

3

u/massenburger Nov 14 '19

We use this library day in and day out where I work, and we absolutely love it. They have a configurable option for just about anything you can think of. The only downside is that the customized themes breaks the regular import statement. The standard import still wants to import the default style, so we had to grab the bundled version from the dist/ folder directly. Other than that, it's been great!

2

u/Mionel_ Nov 14 '19

Nice work, exactly what I needed right now.

2

u/parekh07 Nov 14 '19

Always loved swal, I just wanna thank you for it.

2

u/[deleted] Nov 14 '19

Nice ill have to update my admin suites

2

u/boomkatandstarr Nov 14 '19

I use sweetalert2 all the time. Amazing library!

2

u/PrinnyThePenguin Nov 14 '19

Looking good!

2

u/sammyb0ye Nov 14 '19

Been introduced to swal recently and already migrated 3 projects, I really dig it. Thank you for the work you put in it!

1

u/rabakilgur Nov 14 '19

When using the demo “A confirm dialog, with a function attached to the "Confirm"-button...” the windows flashes for a slit second when the first modal disasters and the second one appears. IMO that’s a real deal breaker.

But other than that it looks great. Nice work!

1

u/13MHz Nov 15 '19

Love it... Definitely going to use it.