Open-source project
sweetalert2/sweetalert2 avatar
sweetalert2/sweetalert2

SweetAlert2 ships two bundles and a declaration file, and pins its types to TypeScript 4.8.4

✨ A beautiful, responsive, highly customizable and accessible (WAI-ARIA) replacement for JavaScript's popup boxes. Zero dependencies. 🇺🇦🇪🇺

18,100 stars1,616 forksJavaScriptMIT

At a glance

What is it?
SweetAlert2 replaces the browser's alert, confirm and prompt boxes with accessible modals and has no runtime dependencies. This piece covers what the package exposes, how the framework wrappers are split out, and what the repository leaves undocumented.
Who is it for?
Pick SweetAlert2 when you want themed, accessible replacements for alert and confirm in plain JavaScript or in React, Angular or Laravel through the wrapper repositories. Skip it if you need install commands in the repository itself, because they live only on the homepage.
Can I use it commercially?
Yes. MIT is a permissive licence: you can use, modify and sell software built on it, as long as you keep its copyright and licence notices.
Is it still maintained?
Yes. The repository last received commits 2 days ago.
What is it written in?
Mainly JavaScript, according to GitHub's language statistics.

Answers come from the project's GitHub data, last synced on November 25, 2026, and from our analysis. They are not legal advice.

From daily snapshots

Star history

  • sweetalert2/sweetalert218,100 ★ · -1
Star history
Repository2026-10-082026-11-25
sweetalert2/sweetalert218.1k18.1k

-1 Stars in the last 48 days, measured from the daily GitHub snapshot. Compare with other projects

Editorial analysis

A popup replacement with zero dependencies and WAI-ARIA as the stated goal

SweetAlert2 is described by its maintainers as a beautiful, responsive, customizable and accessible (WAI-ARIA) replacement for JavaScript's popup boxes, with zero dependencies. The primary language is JavaScript and the license is MIT. The homepage is https://sweetalert2.github.io.

The package.json description adds one more phrase: it is a supported fork of sweetalert. That line is the only statement in the README and package metadata about where the project came from. The older package is not named further, and nothing is said about what was changed from it, so migration from the original sweetalert is something you would have to test yourself.

The accessibility claim is a single label, WAI-ARIA, repeated in the description and the package metadata. There is no conformance statement, no list of screen readers, and no audit report among the top-level files. Treat it as an intent, then check the modals with the assistive technology your users run.

Three package fields point at two bundles and one declaration file

The package.json at version 11.26.25 declares its entry points explicitly. The main field and the browser field both point to dist/sweetalert2.all.js. The module field points to dist/sweetalert2.esm.all.js. The types field points to sweetalert2.d.ts, which sits at the repository root next to package.json.

The practical result is that a bundler that honors module gets the ES module build, while Node-style require and plain script inclusion get the same all.js file. Because main and browser are identical, there is no separate server build, and the library is written for a browser DOM.

The files array lists what is published to npm: dist, src, themes and sweetalert2.d.ts. Shipping src alongside dist means you can read the original source in node_modules. Shipping themes means the stylesheet variants come in the package rather than from a separate download. The repository also contains CHANGELOG.md, SECURITY.md and SPONSORS.md at the top level.

The types file is guarded by a comment that forbids upgrading TypeScript

A devDependenciesComments block in package.json carries one warning, attached to typescript: do not upgrade TS, because the tests verify that the types work with the very first version of TS at or above 4.8.4. The devDependency is pinned to exactly 4.8.4, with no caret.

For a consumer, that means sweetalert2.d.ts is written and tested against a floor of TypeScript 4.8.4. Projects on older compilers are outside that guarantee. The upper end is not stated, since the test target is the oldest supported version and not the newest.

The pin has a cost for contributors. The rest of the toolchain moves forward: @babel/core ^8.0.1, rollup ^4.0.0, vite ^8.0.0 and stylelint ^17.0.0 are all current-major ranges, yet the compiler stays frozen. Anyone sending a pull request that touches the declaration file has to write types that a 2022-era compiler accepts.

Rollup, Babel and Sass build the bundles, Cypress and Playwright WebKit test them

The devDependencies show the build and test chain. Rollup 4 with @rollup/plugin-babel and @rollup/plugin-terser produces the bundles, with @babel/preset-env handling syntax targets. Sass ^1.83.0 compiles the styles. The repository includes rollup.config.js, release.config.js, cypress.config.mjs, bunfig.toml and bun.lock, so Bun is the package manager the lockfile belongs to.

Testing uses Cypress ^15.0.0, with playwright-webkit ^1.37.1 installed so Safari's engine is covered. jquery ^4.0.0 is a dev dependency as well, which fits a test directory that checks the library next to jQuery pages, though the repository does not say so. Linting and formatting go through oxlint ^1.51.0, oxfmt ^0.58.0 and stylelint with the @sweetalert2/stylelint-config package.

None of this is installed when you add the library to an app. The published package has no runtime dependency, which matches the zero-dependencies claim, and the dev tooling stays in the maintainers' checkout.

React, Angular and Laravel support lives in three other repositories

The core package is framework-agnostic, and the framework glue is not in this repository. The README header links to sweetalert2-react-content for React, ngx-sweetalert2 for Angular, and sweetalert2-laravel for Laravel, all under the sweetalert2 GitHub organization.

That split decides where an integration bug is reported. A problem in how a React component renders modal content belongs to sweetalert2-react-content. A problem in the modal itself belongs here. The wrappers carry their own versions, so a core bump to 11.26.25 does not by itself tell you which wrapper release was tested against it.

For plain HTML pages, the README points to the homepage sections for installation, usage and examples, plus a recipe gallery at https://sweetalert2.github.io/recipe-gallery/. PHP and ASP.NET C# are not mentioned in the README. A server-rendered page in either stack uses the browser bundle the same way it would in static HTML.

No install command or usage snippet exists in the repository README

A reader who opens the README looking for an install line finds none. The Installation, Usage and Examples entries are links to anchors on the homepage: #download, #usage and #examples. The README contains no npm command, no CDN script tag and no code sample.

That has two consequences. First, anything you copy as a command comes from the homepage, which can change independently of the repository, so the repository cannot be used to verify it. Second, the exact option names for building a modal are not in the README. The sweetalert2.d.ts file is the closest in-repository reference, since it types the options.

If you need to check an option, read the declaration file or the src directory shipped in the npm package, which is why the files array including src matters.

Sponsor tables dominate the README and the maintainer asks for email contact

Most of the README by length is a sponsor section. It opens with a Hostinger hosting discount line, then a Sponsors table with a Become a sponsor link to SPONSORS.md, followed by a second group headed NSFW Sponsors with its own link. The listed names include Roboflow and BluePlenum in the first group and a long run of adult-product vendors in the second.

For a team adopting the library, this matters in two ways. If you render the README in an internal wiki or a package review, expect that content to appear. And a company policy that restricts adult-content links in vendor documentation will flag this repository's front page even though the library code is unrelated.

Sponsorship questions go to [email protected]. That address is the only contact route the README gives, and SECURITY.md sits at the top level.

Recent releases land every few months and the last push was 2026-10-14

The repository is not archived. The most recent push was on 2026-10-27. The latest tagged releases are v11.26.25 on 2026-05-23, v11.26.24 on 2026-03-20 and v11.26.23 on 2026-03-16, so patches in that window came between four days and about two months apart.

A push on 2026-10-27 that is later than the last tag at 2026-05-23 means there is committed work on main that has not been released under a version number. Pin to a tag rather than to main if you want a reproducible build.

The release.config.js file indicates that releases are produced by a release tool configuration instead of by hand, though the repository does not document the release procedure itself. The version scheme is a single major line, 11, with the minor at 26, which tells you patch updates inside 11.26 are the normal rhythm.

Editorial conclusion

Pick SweetAlert2 when you want themed, accessible replacements for alert and confirm in plain JavaScript or in React, Angular or Laravel through the wrapper repositories. Skip it if you need install commands in the repository itself, because they live only on the homepage. Before adopting, confirm which wrapper repository your framework needs and check the latest tag against the v11.26.25 release of 2026-05-23.

Frequently asked questions

What is SweetAlert2?

SweetAlert2 is a JavaScript replacement for the browser's popup boxes. It is described as responsive, customizable and accessible (WAI-ARIA), with zero dependencies.

How do I use SweetAlert2 in React?

React support is a separate package, sweetalert2-react-content, under the sweetalert2 GitHub organization and linked from the README header. The core repository itself contains no React code.

Is SweetAlert2 free?

The repository license is MIT. Sponsorship is solicited in the README, but nothing in the repository makes the library paid.

How do I install SweetAlert2?

The README contains no install command and points to the Installation section of https://sweetalert2.github.io. The npm package name in package.json is sweetalert2, version 11.26.25.

Official sources

  1. License: MIT
  2. Project website
  3. README
  4. Releases
  5. sweetalert2/sweetalert2 on GitHub
Add this badge to your README

If you maintain this project, the badge below links readers to this analysis and shows its maintenance status from the daily GitHub snapshot. Paste the markdown into your README; add ?metric=license or ?metric=stars to the image URL for a different field.

Add this badge to your README

markdown
[![Hysen Labs](https://hysenlabs.com/badge/sweetalert2-sweetalert2.svg)](https://hysenlabs.com/projects/sweetalert2-sweetalert2)

Star history chart for your README

markdown
[![Star history](https://hysenlabs.com/chart/sweetalert2-sweetalert2.svg)](https://hysenlabs.com/projects/sweetalert2-sweetalert2)

Was this useful?