sweetalert2-react-content alternatives and similar libraries
Based on the "Overlay" category.
Alternatively, view sweetalert2-react-content alternatives based on common mentions on social networks and blogs.
-
sweetalert2
β¨ A beautiful, responsive, highly customizable and accessible (WAI-ARIA) replacement for JavaScript's popup boxes. Zero dependencies. πΊπ¦ -
react-modal
Accessible modal dialog component for React -
react-overlays
Utilities for creating robust overlay components -
react-aria-modal
A fully accessible React modal built according WAI-ARIA Authoring Practices -
react-skylight
A react component for modals and dialogs -
react-modal2
:thought_balloon: Simple modal component for React. -
modali
A delightful modal dialog component for React, built from the ground up to support React Hooks. -
reoverlay
The missing solution for managing modals in React. -
reboron
A collection of dialog animations with React.js
Appwrite - The Open Source Firebase alternative introduces iOS support
* Code Quality Rankings and insights are calculated and provided by Lumnify.
They vary from L1 to L5 with "L5" being the highest.
Do you think we are missing an alternative of sweetalert2-react-content or a related project?
README
sweetalert2-react-content
Official SweetAlert2 enhancer adding support for React elements as content.
The following options can be React elements:
- title
- html
- confirmButtonText
- denyButtonText
- cancelButtonText
- footer
- closeButtonHtml
- iconHtml
- loaderHtml
Installation
npm install --save sweetalert2 sweetalert2-react-content
Usage Example
import Swal from 'sweetalert2'
import withReactContent from 'sweetalert2-react-content'
const MySwal = withReactContent(Swal)
MySwal.fire({
title: <p>Hello World</p>,
didOpen: () => {
// `MySwal` is a subclass of `Swal` with all the same instance & static methods
MySwal.showLoading()
},
}).then(() => {
return MySwal.fire(<p>Shorthand works too</p>)
})
The dist/sweetalert2-react-content.umd.js
file defines window.sweetalert2ReactContent
in non-CJS/AMD environments.
Limitations
SweetAlert2 renders its content outside of the ReactTree
. In order to render React Router components (such as Link
) you have to wrap them in the routing context which should be the same with the app.
That can be achived by using the HistoryRouter
with shared history
. Please refer to the official code example βοΈ
*Note that all licence references and agreements mentioned in the sweetalert2-react-content README section above
are relevant to that project's source code only.