GithubHelp home page GithubHelp logo

aeimi / frostifymodal Goto Github PK

View Code? Open in Web Editor NEW

This project forked from ksroga/frostifymodal

0.0 0.0 0.0 80 KB

Ultra lightweight, dependency-free javascript library for creating dynamic & full-customizable modal dialogs.

JavaScript 74.48% CSS 16.36% HTML 9.16%

frostifymodal's Introduction

FrostifyModal.js

License

Ultra lightweight, dependency-free javascript library for creating dynamic & full-customizable modal dialogs.

Features

✔ Full-customizable styles

✔ Closes modal dialog on overlay click

✔ Closes modal dialog on pressing the ESC key

✔ Pressing TAB is working inside the modal.

✔ Ultra lightweight - it's only ~9kb!

Installation

via npm

npm i frostify-modal

Usage

Example usage:

FrostifyModal.set({
    title: 'Modal title',
    content: 'Text content',
    onok: () => {
        alert('Clicked ok button');
        return false; // do not close modal
    },
    oncancel: () => {
        alert('Clicked cancel button');
    },
    labels: {
        ok: 'Okay!',
        cancel: 'Cancel'
    }
}).show();

Available methods:

Method nameArgumentsDescription
set()Empty stringModal title.

Available config parameters:

NameDefault valueDescription
titleEmpty stringModal title.
contentEmpty stringModal content.
onOknullSubmit action callback.
onCancelnullCancel action callback.
isClosable trueDefines if modal is closable.
isDraggable trueDefines if modal is draggable.
reverseButtons falseIf true buttons are reversed.
labels ok: Okay
cancel: Cancel
Define button labels.
containerStylesEmpty objectContains modal container styles. You can use any css styles here.
headerStyles Empty objectContains modal header styles. You can use any css styles here.
bodyStyles Empty objectContains modal body styles. You can use any css styles here.
footerStyles Empty objectContains modal footer styles. You can use any css styles here.
buttonsStyles Empty objectContains modal buttons styles. You can use any css styles here.

Example with all availables configuration parameters:

FrostifyModal.set({
    title: 'Modal title',
    content: 'Text content',
    onok: () => {
        alert('Clicked ok button');
        return false; // do not close modal
    },
    oncancel: () => {
        alert('Clicked cancel button');
    },
    labels: {
        ok: 'Okay!',
        cancel: 'Cancel'
    },
    isClosable: true,
    isDraggable: true,
    reverseButtons: false,
    containerStyles: {
        radius: '25px',
    },
    headerStyles: {
        background: '#FFFFFF',
        color: '#000000',
        textAlign: 'left',
    }
}).show();

Licensing

This project is licensed under MIT license.

Created and maintained by

Konrad Sroga – @ksroga 🇵🇱

frostifymodal's People

Contributors

ksroga avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.