Introduction

All examples throughout this guide are written by ES6, you can aslo use it in ES5 enviroment.

Mask

source: https://github.com/regular-ui/bootstrap/tree/master/src/Mask.js

Mask Component providing a masking layer for developer.


Simple Mask

Contained Mask

you can use container to specified custom container, default is document.body.

transclude content in Mask

you combine mask with other content, the following example use svg as its content.

Beacuse content is injected to div.modal-dropdown whose opacity is 0.5. so element is semilucent

Programmatic initializing

Instead of use Mask as composite Component like:

<mask show={true} bgColor=red auto-close></mask>

You can also use it in Programmatic way

var mask = new Mask({
  $body: '<div class="loading"></div>', // as transcluded
  data: {
    show: true,
    bgColor: 'red',
    autoClose: true
  }
})

Mask also provide a preCompiled mask instance, you can use Mask.show([autoClose]) to toggle it.

var mask = Mask.show({
  bgColor: '#fff',
  autoClose: true
})

// only toggle show
var mask = Mask.show(true)
Example

Usage

you can also use other common methods

Data

Name Type Default Description
bgColor String null (controlled by .*-backdrop)
layer String 'modal' one of 'modal','dropdown' , control the backdrop className for handling z-index
show Boolean false control the visibility
this.$body String or Transcluded null used as mask 's body

Methods

mask.toggle()

Toggle mask's visiblity

Mask.show([config]) (static method)

A shortcut to call a Mask;

config

  • Boolean config: will passed as autoClose
  • Object config: see previous Data section for help

return: Mask

Overlay

source: https://github.com/regular-ui/bootstrap/tree/master/src/Mask.js

Overlay is used for position element to close specified target


simple overlay

overlay placement

  1. you can pass palcement to position overlay to particular direction: top, bottom, left, right is supported

  2. pass gap to control the gap from overlay to target.

autoClose overlay

if pass autoClose, whenever you click area out of the overlay, it will be closed.

Overlay can be combined with Tooltip and Pophover

See Tootip and Pophover for detail

Pophover

Tooltip

Tab

DropdownButton

source: https://github.com/regular-ui/bootstrap/tree/master/src/DropDownButton.js