The BeforeQuery widget is a single script tag that adds instant search and streaming RAG chat with source citations to any page. Styles are isolated in a Shadow DOM — zero CSS leakage.

Quick start

Full configuration

Every option can be set via data-* attribute (script tag) or the equivalent camelCase option (programmatic API):

View modes

A centered overlay triggered by the floating launcher. Closes on backdrop click or Esc.

Programmatic API

For SPAs, initialize and control the widget from code:

Keyboard shortcut & dark mode

  • Cmd+K (Mac) / Ctrl+K (Windows/Linux) opens the widget by default. Change with data-hotkey="/" or disable with data-hotkey="none". Esc always closes.
  • The widget follows prefers-color-scheme automatically and switches theme in real time; force with data-color-scheme="dark" or "light".

Features at a glance

  • Instant search results as you type (debounced 250 ms)
  • Streaming RAG chat with numbered source citations
  • Follow-up questions continue the same thread
  • Thumbs up / down feedback
  • reCAPTCHA v3 support (configured server-side via the widget-config API)
  • Mobile full-screen sheet layout
  • White-label branding: custom name, logo, accent color, and hideable footer (enterprise)

Local testing