A simple overlay UI component.
$ component install segmentio/overlay
var overlay = require('overlay');
overlay().closeable(); // the body now has an overlay on it
Show an overlay on a given target
element, defaulting to document.body
.
Show the overlay, optionally calling a callback fn
. Emits showing
and show
.
Hide the overlay, optionally calling a callback fn
. Emits hiding
and hide
.
Remove the overlay from the DOM optionally calling a callback fn
. If the overlay isn't hidden yet, hide it first. Emits removing
and remove
.
Make the overlay closeable by clicking on it, or hitting the ESC
key. Aliased to closable
for convenience.
Make the overlay remove itself after it's been hidden. This is useful for one-off overlays where you don't want to have to manage removing it from the DOM.
component/emitter
is mixed in.
ianstormtaylor/classes
is mixed in.
MIT