0.2.5 • Published 8 years ago

simple-callout v0.2.5

Weekly downloads
3
License
MIT
Repository
github
Last release
8 years ago

Simple Callout

Build status Bower dependencies Version Size Cross browser test status

A simple, style-agnostic callout box that can be shown and hidden from any position.

Installation & usage

Install simple-callout with Bower

$ bower install simple-callout --save

Import it into the <head> of your page

<link rel="import" href="/bower_components/simple-callout/simple-callout.html">

Then use simple-callout in your project

<simple-callout arrow="top left">
  <span>My callout contents</span>
</simple-callout>

To ensure that the content inside the callout is layered on top of the callout's arrow, always use elements rather than just text nodes (eg: <span>text</span> instead of text);

Polyfills for cross-browser support

Simple callout relies on emerging standards, and you will need to include polyfills for cross-browser support:

<script src="/bower_components/webcomponentsjs/webcomponents-lite.js"></script>

--

Options

PropertyTypeDefaultDescription
activeBooleanfalseControls whether the callout is visible or not
originStringundefinedThe origin position that the callout expands from. Can be any combination of top/bottom/left/right/center
arrowBooleanfalseWhether the callout has a little arrow at its origin
noOutsideClickBooleanfalseDisable closing the callout on outside clicks
noEscapeBooleanfalseDisable closing the callout on escape key presses
<simple-callout origin="bottom center" arrow no-escape></simple-callout> 

Methods

MethodArgumentsDescription
open()noneUtility method to open the callout
close()noneUtility method to close the callout
toggle()noneUtility method to toggle the callout

Styling

In addition to styling the callout directly, you can also set these CSS properties

PropertyDefaultDescription
--simple-callout-arrow-size8pxSize of the callout's arrow

Apply properties on simple-callout

simple-callout {
  --simple-callout-arrow-size: 12px;
}

--

MIT © Simpla