r/webdev • u/limonmonte • Jan 22 '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/13
u/sanjibukai Jan 22 '19
The demos are really smooths..
Very nice library that was lacking (or I am unaware of any)..
I saw that everything seems customisable but is it possible to customize the library default so that it will no longer need to customize in every popup code?
For example I found that bouncy effects really annoying..
15
u/limonmonte Jan 22 '19
Of course!
const SwalWithoutAnimation = Swal.mixin({ animation: false })SwalWithoutAnimation.fire('hello non-animated world')More info about mixins: https://sweetalert2.github.io/#mixin
1
4
Jan 22 '19
Side panel?
9
u/limonmonte Jan 22 '19
Sure, anything that is popup could be implemented with SweetAlert2: https://scandalous-deal.glitch.me/
4
u/CherryJimbo Jan 22 '19
As I mentioned in the other thread, we've been using this in production for the better part of a year now. Loving the frequent updates and improvements. The upgrade path between versions is always very clearly defined, and we very much appreciate that.
1
u/limonmonte Jan 23 '19
Thank you for the kind words, CherryJimbo! We work hard to avoid any kind of breaking changes (including the smallest ones like changing SASS variables names), so our users can feel safe when running `yarn upgrade sweetalert2`
3
Jan 22 '19
Starred on Github! Thank you!
3
u/limonmonte Jan 22 '19
Thank you! Every ⭐ motivates us to bring the best possible quality to our users!
3
u/MisterMockery Jan 22 '19
I was going through all the "try me" examples and the ajax example hangs if an invalid username is entered, with no way to close the modal. Had to refresh the page.
5
2
u/Mcshizballs Jan 22 '19
Man I used this 5 years ago. Thanks for making me feel old
1
u/limonmonte Jan 23 '19
SweetAlert2 is 4 years old, it was started Jan 3rd, 2015. Here's its star chart: https://starcharts.herokuapp.com/sweetalert2/sweetalert2
2
u/karnthis Jan 23 '19 edited Jan 23 '19
Very nice, never heard of this.
It seems your trigger something else with “cancel” is not working, it doesn’t give me the second window in the example code. On safari - iOS 12 - iPhone 7 Plus.
Thanks for sharing!
1
2
Jan 23 '19
Any reason there's react and angular implementations but not VueJS?
1
u/limonmonte Jan 23 '19
Not really, SweetAlert2 collaborators are using React and Angular. I would be more than happy if someone could bring a good level of VueJS experience to us.
Also, there's the unofficial community plugin: https://github.com/avil13/vue-sweetalert2
2
u/picklemanjaro Jan 23 '19
Nice library! Going to definitely look into working this into future projects. :)
One question though, is there any documentation about toasts? I saw it said it does it in the GitHub GIF, but not in the Readme not the documentation page.
1
u/limonmonte Jan 23 '19
It's here, for now, https://sweetalert2.github.io/#mixin but I agree with you that we can improve docs about toasts, thanks for bringing that up!
1
u/picklemanjaro Jan 24 '19
Oh! Turns out that anchor doesn't go anywhere on mobile. Opened it in a desktop browser and saw it just fine!
Wasn't aware that the mobile site had abbreviated content!
Thanks for the link though, totally addresses my question about Toasts!
40
8
12
Jan 22 '19
Been using this for years. Thanks for all of your hard work.
Whenever I see sites use this out in the wild I smile. Jackbox games uses it if you didn't already know.
4
4
4
4
u/iamtravisw Jan 22 '19
My verbal reaction after clicking the 'show normal alert' button: "boring"
My verbal reaction after clicking the 'show success message' button: "wooowee! that's a pretty confirmation"
Great work on this!
3
u/flayz69 Jan 22 '19 edited Jan 22 '19
This looks awesome! Would definitely like to start using it. How does it go for browser compatibility?
EDIT: Found my answer here :)
https://github.com/sweetalert2/sweetalert2#usage
3
2
2
2
2
u/794613825 Jan 22 '19 edited Jan 22 '19
This looks great, but quick bug: swiping on mobile while a dialog is open causes the background to scroll twice as fast.
2
Jan 22 '19
I haven't seen this before and am actually about to implement something similar in an upcoming freelance project for a client. Thanks for the time-savings and (most likely) happier client!
2
Jan 23 '19
Wow, we’ve been looking for an accessible replacement for lightbox. I’m glad we waited 8 years. This is awesome!
How well does it handle multi-input modals, like login prompts?
2
2
2
u/waveform Jan 23 '19
It is indeed lovely! Question - went through the examples - does it handle multiple overlayed popups?
For example, if not finding Github user ID, can it show a "Not Found" dialog with an "ok" button, without closing the ID input dialog, then after clicking "ok" return focus to the input dialog?
2
1
1
0
-16
u/vsync Jan 22 '19
nothing will ever be as """""""""beautiful""""""""" as the native UI of my chosen user agent and window manager
and not very accessible when a single misclick closes the """"""""""dialog""""""""""
13
-8
u/merdianii Jan 22 '19
Looks good but as I'm new to JavaScript would love to see the JavaScript code and have no fucking idea why it doesn't show on Codepen
0
Jan 22 '19
[deleted]
-1
u/merdianii Jan 22 '19
I was looking at the code on Codepen there was no code of JavaScript expect 2-3 lines which were some another framework
44
u/MCorean Jan 22 '19
Hey Limon! Just curious - is there an update or new feature for Swal2 that you're posting this? I'm sure a lot of devs here use Swal2 so I'm just curious as to why you're posting it.
If it's just for people who haven't heard of it, then never mind and carry on :)
I use this for almost all of my projects so thank you for making this wonderful library!