Context component
<wy-context>
| WyContext
The context component provides an alternative way of initializing the Weavy UIKit that does not require creating an instance of the Weavy
class.
This can be useful in some scenarios, for instance in low-code and no-code platforms with limited javascript functionality.
Importing
If you installed the UIKit with npm
you can use the following snippet to import the component into your project.
Otherwise, if you installed the UIKit as a <script>
you can ignore this section.
import { WyContext } from "@weavy/uikit-web";
Examples
The context component can be used by itself as seen in the example below.
<wy-context
url="{WEAVY-URL}"
tokenUrl="https://example.com/myapp/token"
></wy-context>
...
<h1>Messenger with standard weavy configuration</h1>
<wy-messenger></wy-messenger>
It can also be used as a context provider where you place other Weavy components as children of the context provider.
<wy-context url="{WEAVY-URL}" tokenUrl="https://example.com/myapp/token">
<h1>Messenger inside a weavy context provider</h1>
<wy-messenger></wy-messenger>
</wy-context>
Properties
Property | Type | Description |
---|---|---|
url * |
string, URL |
URL to your Weavy environment. |
tokenFactory * |
WeavyTokenFactory |
Async function returning an access_token . See Authentication for details. |
tokenUrl * |
string, URL |
URL to token endpoint. Can be specified instead of tokenFactory . |
locale |
string |
Preferred locale. See localization for details. |
locales |
string[] |
Array of enabled locales. See localization for details. |
localesUrl |
string |
Base url where translation files can be found. Defaults to ./locales . |
notificationEvents |
boolean |
Set to true to enable the wy-notifications event. |
reactions |
string |
Space separated string of unicode emojis to use for reactions. Defaults to reactions from the Weavy instance.` |
Learn more about attributes and properties.