Component
Using Regularjs to Rebuilt Bootstrap Component , All Examples Below Support Living Editing ( clicking 'Source code' )
Using Regularjs to Rebuilt Bootstrap Component , All Examples Below Support Living Editing ( clicking 'Source code' )
All examples throughout this guide are written by ES6, you can aslo use it in ES5 enviroment.
source: https://github.com/regular-ui/bootstrap/tree/master/src/Mask.js
Mask Component providing a masking layer for developer.
you can use container
to specified custom container, default is document.body
.
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
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)
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 |
mask.toggle()
Toggle mask's visiblity
Mask.show([config])
(static method)A shortcut to call a Mask;
config
Boolean
config: will passed as autoCloseObject
config: see previous Data
section for helpreturn: Mask
source: https://github.com/regular-ui/bootstrap/tree/master/src/Mask.js
Overlay is used for position element to close specified target
you can pass palcement
to position overlay to particular direction: top
, bottom
, left
, right
is supported
pass gap
to control the gap from overlay to target.
if pass autoClose
, whenever you click area out of the overlay, it will be closed.