Skip to content

KoryNunn/modal-component

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

modal-component

A simple modal component

Built with fastn.js

Usage

Settings

{
    show: any truthy/falsey value
}

Standalone

// Create the modal
var modal = createPicker({
        options: ['foo', 'bar', 'baz']
    });

// Watch for changes to the modal's value
modal.value.on('change', function(value){
    console.log(value);
});

// Put the modal's element somewhere in the DOM.
document.body.appendChild(modal.element);

Fastn component

var fastn = require('fastn')({
    ... other components...
    modal: require('modal-component/modalComponent')
});

var modal = fastn('modal', { options... });

modal will attempt to use text, _generic, list and templater components provided by fastn.

Inserting

someDomNode.appendChild(modal.element);

Properties

Show

// retrieve value
modal.show(); // returns value of show

// set value
modal.show(newValue); -// returns modal.show property

// watch for changes
modal.show.on('change', function(show){
    // Do something
});

About

A simple modal component. Built with `fastn.js`

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published