OSS TanbouSign in with GitHub

replace alert, confirm, and prompt dialogs with WAI-ARIA-aware popups that resolve through Promises

About these scores

OSS scale score is an unbounded metric that log-compresses and weights Stars, Watchers, Forks, and Contributors. Discovery score is the current OSS scale score minus the score at discovery. Update pace is commits in the last 30 days, growth momentum is the OSS scale score difference within the recent observation window, and OSS health is a 0–100 rating based on available recency, Community Health, and release data.

Stars
18,098
Primary language
JavaScript
License
MIT
Repository last updated
Sep 18, 2026
On this page

Overview

SweetAlert2 is a UI library that replaces native JavaScript alert, confirm, and prompt boxes with responsive, customizable popups. With no runtime dependencies, Swal.fire() accepts options for titles, text, icons, buttons, inputs, and more, then resolves user interaction through a Promise.

Features and best fit

Based on official documentation; not hands-on tested · Content checked:

Key features

Display alerts, confirmations, and input popups with Swal.fire options

Swal.fire() accepts title, text/html, icon, buttons, timers, inputs, and other options. A shorter title/html/icon argument form is also available.

Sources: [2][4]

Branch application flow from Promise-based confirmation, denial, or dismissal results

Swal.fire() returns a Promise of SweetAlertResult, allowing application code to continue based on confirmed values or dismissal reasons after the user acts.

Sources: [2]

Reuse shared dialog and toast defaults with mixin

Swal.mixin() returns a SweetAlert variant with default options, making it possible to reuse input, cancel-button, toast-position, timer, and similar settings across popups.

Sources: [3][2]

Best fit

Fits confirmation, form assistance, and completion notifications that should share one UI system

It is useful when confirmation dialogs, prompts, and toast notifications need consistent presentation and Promise-friendly integration with application workflows.

Sources: [2]

Before adoption

Treat untrusted strings carefully when using the html option

SweetAlert2 accepts both text and html content. Applications should avoid passing untrusted strings directly as HTML and keep content handling under application control.

Sources: [2]

Framework integrations may use separate React or Angular packages

The repository README links separate 連携projects for React, Angular, Laravel, and others, so framework-specific lifecycle and rendering compatibility should be checked separately.

Sources: [1]

Official sources

  1. [1]SweetAlert2 v11.26.25 README(2026-10-05)
  2. [2]SweetAlert2 v11.26.25 TypeScript definitions(2026-10-05)
  3. [3]SweetAlert2 mixin implementation and examples(2026-10-05)
  4. [4]SweetAlert2 webpack usage test(2026-10-05)
  5. [5]SweetAlert2 v11.26.25 package metadata(2026-10-05)
  6. [6]SweetAlert2 MIT license(2026-10-05)
Supplemental curator note

SweetAlert2 is convenient when an application needs richer confirm, input, or toast interactions than native alert() and wants Promise-based results. Swal.mixin() is particularly useful for centralizing repeated dialog defaults.

Try it in 3 steps

  1. 1

    Install SweetAlert2 11.26.25

    Pin the reviewed stable release.

    npm install --save-exact sweetalert2@11.26.25
  2. 2

    Import Swal

    Load the package's default export for displaying popups.

    import Swal from 'sweetalert2';
  3. 3

    Show a confirmation popup and handle the result

    Use the Promise returned by Swal.fire() to branch application flow from the user's confirmation result.

    const result = await Swal.fire({ title: 'Delete this item?', icon: 'question', showCancelButton: true, }); if (result.isConfirmed) console.log('confirmed');
Check the official README

Growth

Growth trends · Last 30 days

18,098 Stars

Trend data is still being collected.

Development activity

Last 90 days · weekly

Commits (last 30 days)
2
Open PRs
0

Development activity is still being collected.

Built with

Categories and tags

Categories

GitHub data

GitHub dataView detailed GitHub data

GitHub Topics

  • sweetalert
  • alert
  • popup
  • prompt
  • dialog
  • toast
  • notifications
  • wai-aria
  • accessible
  • confirm
  • confirmation-dialog
  • sweetalert2
Stars
18,098
Forks
1,620
Watchers
215
Open issues
4
Contributors
117
Owner type
Organization
Primary language
JavaScript
License
MIT
Repository last updated
Sep 18, 2026
Write a related article

Share a guide or use case for this OSS in Markdown. Articles are published after administrator approval.

Report incorrect information

Tell us if any listing information is incorrect or outdated.

After reading this page, do you know what to do next?