Behaviour
What the floating and inline modes do, how auto height sizes the frame, the launcher and trigger options, open on load, voice off, keyboard handling and what happens when a conversation completes.
Two modes, and a handful of options that decide when the panel opens and what the frame may do.
Floating
The default. A launcher sits in a bottom corner and opens a panel. The conversation frame is
created on the first open, so a page the visitor never interacts with loads nothing beyond
widget.js. Escape closes the panel.
| Option | Does |
|---|---|
launcher | chat, mic or none. none draws no launcher; open the panel from your own control with the launcher slot, a trigger-selector or betterfeedback("open") |
launcher-label | Text next to the icon. Empty shows the icon alone |
position | bottom-right or bottom-left |
offset-x, offset-y | Pixels from the side and bottom edges, at most 512 |
open-on-load | Open the panel as soon as the page loads |
trigger-selector | A CSS selector; clicking any matching element on your page toggles the panel. An invalid selector is ignored and never breaks your page's own clicks |
Inline
data-target on the script, or mode="inline" on the element, renders the conversation inside
its container, always open, with the frame created at once. The surface behind the conversation
is transparent, so it sits on your page's own background unless you set --bf-surface.
Without auto height the frame is --bf-panel-height tall and scrolls inside. With auto-height
the frame follows the conversation's content height, between min-height and max-height
(defaults 320 and 900 pixels), and the element dispatches a resize event each time it changes.
Welcome screen and auto start
A survey with a welcome message opens on a welcome screen: the first line of the message is the headline, the lines after it are shown below as body text with their line breaks kept, and the visitor presses Start. A survey with no welcome message has no such screen and starts on load.
auto-start (data-auto-start on the script tag, autoStart in JavaScript) removes the Start
click while keeping the text: the conversation starts on load and the welcome message sits above
it. Use it when the page around the embed already says what the box is. The conversation always
opens in text mode, so starting on load never asks for the microphone.
Formatting the welcome and ending messages
Both messages are written in the dashboard's survey editor, which has a small toolbar: bold, italic, link and bullet list. They are stored as text with these marks:
| You write | It shows as |
|---|---|
**bold** | bold |
*italic* | italic |
[our plans](https://example.com/pricing) | a link that opens in a new tab (http, https and mailto only) |
a line starting with - | a list item |
| a blank line | a new paragraph |
| a single line break | a line break |
Nothing else is interpreted: headings, images and HTML show as the characters you typed. The first line of each message is its headline. When the agent says the ending message, in chat or aloud, it says the words without the marks.
Voice
Voice is on by default: the conversation shows a Talk button and the frame carries the
microphone capability. voice="false" removes both, so the conversation is text only and the
visitor is never asked for the microphone.
The frame's permissions are set when it is created, so set voice before mount: on the script
tag, on the element, or in the mount call. Changing it afterwards changes the controls but not
the frame's permissions.
Completion
When the conversation finishes, the element dispatches completed and the page shows the
survey's ending message.
If the survey is set to redirect on completion, the respondent is not sent away at once. The
ending screen stays for five seconds with a line confirming that the answers were sent, a
countdown that names the destination site, and a "Continue now" button. The three strings are
the copy keys answersSent, redirectNotice (with {site} and {seconds}) and continueNow.
In an embed the redirect happens inside the frame, not on your page: listen for completed,
read redirectUrl from its detail and navigate the top window yourself.
JavaScript API has the event table.
When the session ends early
ended fires with a reason: disconnected when the connection dropped, other-tab when the
same conversation was opened elsewhere. error fires with mic-denied, no-agent or
unavailable, so your page can show its own message or fall back to a form.
Theming
Restyle the embed from the outside with --bf-* custom properties for colour, shape and type, ::part() selectors and named slots on the shell, copy keys for every string, and the colour scheme and font options.
JavaScript API
The betterfeedback() command vocabulary for opening, configuring and mounting the embed, the events it dispatches on the element and document, the queue stub for calls made before the script loads, and the message shape a plain iframe receives.