Set the widget's color scheme and language. Place it on the page, or open it from your own button.
Color scheme
The widget follows the visitor's system theme by default. Use mode to pin one scheme.
Productlane.init({
widgetKey: "<your-widget-key />",
mode: "dark",
})Value | Behavior |
|---|---|
| Follows the visitor's system setting and switches live when it changes. This is the default. |
| Always renders the light theme. |
| Always renders the dark theme. |
If your site has its own theme toggle, pass the new value to Productlane.set(). The widget repaints without a reload.
Productlane.set({ mode: "light" })The light and dark accent colors live on the Theme page, linked from Settings → Widget → Theme settings. mode only picks which of the two applies.
Language
The widget follows the visitor's browser language, as long as your workspace has that language turned on. To pick the language yourself, pass language to init. A language your workspace hasn't turned on is ignored, and the widget falls back to your default language.
Productlane.init({
widgetKey: "<your-widget-key />",
language: "nl",
})To switch languages later, for example from a language picker in your app, call reload:
Productlane.reload({ language: "de" })Position and offset
position sets where the button sits: "left", "right" (the default), or "center". The panel opens beside the button, or centered for "center".
offset moves the widget away from the screen edges. bottom, left, and right each take a CSS length such as "20px" or "2rem", and all three are optional. Use left or right to match your position.
Productlane.init({
widgetKey: "<your-widget-key />",
position: "left",
offset: {
bottom: "80px",
left: "16px",
},
})Custom trigger button
To open the widget from your own button, hide the default one and call the JavaScript API.
In Settings → Widget, set the icon style to None.
Call
Productlane.open()orProductlane.toggle()from your button's click handler.
<button onclick="Productlane.open()">Open support</button><button onClick={() => Productlane.toggle()}>Open support</button>To open a specific view, pass its name:
Productlane.open("AICHAT") // the AI agent
Productlane.open("FEEDBACK") // the contact formTo open the chat with a message already filled in, use askAi:
// Fills in the message; the user presses send
Productlane.askAi({ message: "I need help with billing" })
// Sends the message right away
Productlane.askAi({ message: "I need help with billing", autoSend: true })The AI agent answers first. When it can't help, or the user asks for a person, the conversation goes to your team.
The size of the built-in button cannot change. For a larger or differently styled trigger, use your own button.
