Drop-in UI options

Typically, adding the Drop-in UI to your application or website is enough to get you started. But you probably want to tweak the default options a bit to make your Weavy behave the way you want it to.

Using options

Specify options by passing an object with properties when constructing the Weavy instance. You may pass several objects with options to the constructor that will be merged. This means you can have common options in one object and another object with specific options.

var weavy = new Weavy({
  url: 'https://weavy-server.example',
  tokenFactory: async (refresh) => '{server_provided_access_token}',
  stylesheet: '/styles/weavy-default.css'
});

The minimum required options to get started is to specify the url to the weavy backend and an async tokenFactory function to provide authentication from your backend.

Option Type Description
css string General CSS overrides
id string A string identifying the weavy instance. This option is automatically set unless you specify it.
init boolean Indicates if Weavy should init automatically. Set it to false to init weavy manually using weavy.init()
tokenFactory * function async function returning a string access token for authentication from the backend.
logging boolean Indicates if logging is turned on. Set to true to turn on all console logging.
plugins object Options for plugins. See for example history to configure deeplinks plugin.
stylesheet URL General weavy stylesheet for styling. May also be an array of multiple stylesheets.
tz string Timezone identifier, e.g. Pacific Standard Time. When specified, sets the timezone to use when rendering dates and times. The list of valid timezone identifiers depends on the operating system of your Weavy server as documented on TimeZoneInfo.Id
url * URL Url to your Weavy backend.

* Required options

Default options

The default options are stored in an object as a property called Weavy.defaults on the Weavy class. You can read or set these options before you create a new Weavy instance. The defaults will be applied on all Weavy instances unless other options are specified.

Weavy.defaults.url = '{weavyurl}';

var weavy = new Weavy({
  tokenFactory: async (refresh) => '{server_provided_access_token}'
});
Weavy Docs