NGX Spotlight
An angular directive to highlight 🔦 DOM element by adding a overlay layer to the rest of the page
Installation
To install this library, run:
$ npm install ngx-spotlight ngx-window-token --save
and then import module:
;; ; ; // <===
Usage
Simple case
...
Advanced case
Toggle
Directive can be shown using SpotlightService
.
constructorprivate spotlightService: SpotlightService this.spotlightService.getById'some-id'.show;this.spotlightService.getById'some-id'.hide;
Inputs
Name | Type | Default | Description |
---|---|---|---|
ngxSpotlight | string | 'spotlightat' + Date.now() | id |
border | boolean | false | draw border around spotlight element |
borderWidth | number | 4 | border width in 'px' |
indent | number | 0 | space around spotlight element |
overlay | boolean | false | disable click on spotlight element, fire spotlightClick event |
auto | boolean | false | highlight element after view init |
Outputs
There is a spotlightClick
event that occurs when a user click on directive elements.
;
Customization
Variables should be declared for a global scope (:root or the body selector).
CSS variable | Default value | Description |
---|---|---|
--color__spotlight-backdrop_background | rgba(52, 74, 94, 0.8) | Color of the backdrop |
--color__spotlight-border | #c9c9c9 | Border color of highlighted element |