vvd-context 2.46.1
Install from the command line:
Learn more about npm packages
$ npm install @vonage/vvd-context@2.46.1
Install via package.json:
"@vonage/vvd-context": "2.46.1"
About this version
Vivid components are fully taking care of their styling. Yet there are also a simple native HTML elements, that should also comply with the Vivid Design System.
For this reason we are providing Vivid Context service, responsible of mounting the Vivid styling into a document.
The service is optional, but most likely will be needed in any Vonage application.
Attention!
vvd-context
uses internallyvvd-core
, which sets up the core services like theming and typography, thusvvd-context
user may safely omit any own setup of the core.
Attention! As an initial step, to provide smoother migration and lesser friction with an existing systems (especially those heavily dependent on Volta's legacy), we are scoping most of the Vivid context impact by special class: vivid-scope
.
Please, put vivid-scope
class at the root of the DOM tree, that is ready to be styled by Vivid.
Any new application should just safely put that class on the application DOM root (usually
body
).
Description:
Mounts Vivid context (styles) into the target scope / document. Default target is the document visible in the current scope. The API is idempotent, the style/s will be mounted only once, even if API called multiple times.
Params:
-
target
-Document
orDocumentFragment
(includingShadowRoot
); optional; defaults todocument
Throws:
- if the provided target argument is
null
or not of a typeDocument
orDocumentFragment
import vvdContext from '@vonage/vvd-context';
vvdContext.mount();
const shadowRoot = someElement.shadowRoot;
vvdContext.mount(shadowRoot);