Big Sur Modal is a lightweight (2.1KB minified) library that you can use to make modals in the style of MacOS Big sur. Click here for a demo:
The code for Big Sur Modal is hosted here.
You can put the JS and CSS files in your project like this:
<link rel="stylesheet" src="https://pineapplerind.xyz/libraries/bigsur-modal/src/style.css">
<script src="https://pineapplerind.xyz/libraries/bigsur-modal/src/index.min.js"></script>
To use Big Sur Modal, declare a variable containing the BigSurModal object:
var modal = new BigSurModal({
//arguments here, more info in customization section
})
Then initialize it with the .show() function:
modal.show()
Similarly, you can remove any open modal with the .close() function:
modal.close()
Pass an object into the BigSurModal function with title, description, and buttons.
var modal = new BigSurModal({
title: 'Modal Title!',
description: 'Modal description!',
theme: 'dark',
appIcon: 'https://data.tooliphone.net/iskin/themes/14241/15260/preview-256.png',
buttons: [
{name: 'Cancel', function: 'alert("Are you sure?")'},
{name: 'OK', default: true}
],
})
Written by PineappleRind
Current Version: 1.1.0 Public Beta