import { useEffect, useState } from 'react' import { CodeExample } from './CodeExample' import { CodeWithCopy } from './CodeWithCopy' import { IconExternalLink } from './UiIcons' export function Installation() { return ( <>
$ npm install sweetalert2
Or grab from{' '}
jsDelivr CDN
1. Import the plugin:
It's also possible to import JS and CSS separately, e.g. if you need to customize styles:
2. Call the sweetAlert2-function after the page has loaded
As an old-school alternative, you can initialize the plugin by referencing the necessary files:
Or with the stylesheet separately if desired:
sweetalert2 is the {ordinalSuffix(jsdelivrRank)} most popular package on jsDelivr, with{' '} {parseInt(jsdelivrTotal).toLocaleString()} CDN hits in the last month
) } }