5.0.7 • Published 2 years ago

sweetalert2-react-content v5.0.7

Weekly downloads
18,895
License
MIT
Repository
github
Last release
2 years ago

sweetalert2-react-content

Official SweetAlert2 enhancer adding support for React elements as content.

Build Status npm version

semantic-release badge typescript .d.ts included License: MIT

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 ↗️

gray-react-toolsdevelapp-regional-frontendnodereactorpasswordless-widgeteparts-shared-ui@infinitebrahmanuniverse/nolb-swesupport-worksuite@everything-registry/sub-chunk-2862jumbo-reactkdpa-componentskdpa-components2@asany/startp@bonaventuresystems.com/contacts@bonaventuresystems.com/form_brix@bonaventuresystems.com/presenter-1@bonaventuresystems.com/presenter-2@bonaventuresystems.com/presenter-3@bonaventuresystems.com/com.brixip.iasys.app.administrator@bonaventuresystems.com/com.brixip.iasys.configurator@fanfury/blackfury-wallet-frontendorion-reactdatagridpermission-manager-test4permission-manager-test5klp-ekyc-reactjsmoor-adminproptokenradcod-reactreact-readingeditorshafa-bosylksoft-admin-with-reduxunno-comutilsvite-radcod-reacttable-edit-esvnvuexy-react-admin-dashboard@link-loom/ui-sdk@intersoft/componentes@intersoft/notif@markoarthofer22/react-components.sweet-alert-wrapper@rootbori/react-form-tailwind@nuwe/lib@movisis_tecnologia/web-shared@nafkhanzam/react-next-components@mocobaas/graphiql-mods@mimo-live-sales/mimo-ui@sotaoi/client@targecy/sdk@slatwall/cra-template-ultra-commerce-storefrontapplay-corebonaventure_iasysbrix_iasys@vteam_components/methods@topthink/components@travpro/react-chat@zetahub/blackfury-wallet-frontend@ultracommerce/cra-template-ultra-commerce-storefrontbanyancloud_ui_testcarconnect-storybookcom.brixip.iasys.app.administratorchenudede-cbs-table-crudfastui-reactfeedbacky-popupcrowd-care-websitee-stella-meeting-organizereth-lugonfury.black-frontendcui-libgray-reactintersoft-componentesintersoft-preofertasimbric-theme
5.0.7

2 years ago

5.0.6

2 years ago

5.0.5

2 years ago

5.0.4

2 years ago

5.0.3

2 years ago

5.0.2

2 years ago

5.0.1

2 years ago

5.0.0

2 years ago

4.2.0

3 years ago

4.1.1

3 years ago

4.1.0

3 years ago

3.3.3

3 years ago

3.3.2

3 years ago

4.0.1

3 years ago

4.0.0

3 years ago

3.3.1

3 years ago

3.3.0

3 years ago

3.2.2

3 years ago

3.2.1

4 years ago

3.2.0

4 years ago

3.1.0

4 years ago

3.0.3

4 years ago

3.0.2

4 years ago

3.0.1

4 years ago

3.0.0

4 years ago

2.0.2

4 years ago

2.0.1

4 years ago

2.0.0

4 years ago

1.1.0

5 years ago

1.0.3

5 years ago

1.0.2

5 years ago

1.0.1

6 years ago

1.0.0

6 years ago

0.5.0

6 years ago

0.4.0

6 years ago

0.3.1

6 years ago

0.3.0

6 years ago

0.2.3

6 years ago

0.2.2

6 years ago

0.2.1

6 years ago

0.2.0

6 years ago

0.1.6

6 years ago

0.1.5

6 years ago

0.1.4

6 years ago

0.1.3

6 years ago

0.1.2

6 years ago

0.1.1

6 years ago

0.1.0

6 years ago

0.0.6

6 years ago

0.0.5

6 years ago

0.0.4

6 years ago

0.0.3

6 years ago

0.0.2

6 years ago