AI knowledge on your site,
in any mode you need
One script tag. Four embed modes. Dark-mode sync included. BeforeQuery's website widget turns your existing knowledge base into an always-available AI assistant — as a chat launcher, search bar, sidebar, or Cmd/Ctrl+K command palette.
Four ways to surface AI answers
Switch modes with a single data attribute — no code changes required.
Chat Launcher
DefaultA floating button in the corner of your page opens a full chat panel. The most familiar experience for users — minimal footprint on your page, maximum conversational depth.
- Configurable position: bottom-right, bottom-left, or custom CSS anchor
- Custom launcher icon or text label
- Unread badge when a proactive message is configured
- Smooth open/close animation with scroll-lock on mobile
Search Bar
InlineEmbed a search input directly in your page — inside a navigation bar, a hero section, or a docs header. Typing surfaces instant AI-generated answers in a popover without leaving the page.
- Drop into any layout with a single React component or Web Component
- Debounced query-as-you-type suggestions
- Full answer with citations in the popover; link to expand conversation
- Replaces or augments existing static search inputs
Sidebar
PersistentA fixed sidebar panel pinned alongside your content — always visible, always ready. Ideal for documentation sites where users want to ask questions while reading without losing their place.
- Resizable panel that pushes or overlays page content
- Sticky context: current page URL auto-injected into the system prompt
- Collapse to icon to reclaim screen space
- Keyboard shortcut to toggle open/closed
Command Palette
Cmd/Ctrl+KTrigger a full-screen command palette with Cmd+K (Mac) or Ctrl+K (Windows/Linux). Developers and power users get instant AI answers without reaching for the mouse.
- Activates globally on any page with a single script tag
- Fuzzy-search across question history and knowledge topics
- Arrow-key navigation through suggested questions
- Esc to dismiss; answer expands inline in the palette
Embed in under 60 seconds
Paste the snippet into your page's <head>. Set data-mode to switch between chat launcher, search-bar, sidebar, or command-palette. Every other attribute is optional.
data-mode: chat | search | sidebar | cmdpalettedata-theme: light | dark | auto (default: auto)data-primary-color: any valid CSS colordata-position: bottom-right | bottom-left | customdata-project-id: your BeforeQuery project UUIDdata-client-key: public client key (bq_pk_...)
<script src="https://widget.beforequery.com/v1/widget.js" data-project-id="proj_abc123" data-client-key="bq_pk_..." data-mode="chat" data-theme="auto" data-position="bottom-right" async ></script>
<script src="https://widget.beforequery.com/v1/widget.js" data-project-id="proj_abc123" data-client-key="bq_pk_..." data-mode="cmdpalette" data-theme="auto" async ></script>
<script src="https://widget.beforequery.com/v1/widget.js" data-project-id="proj_abc123" data-client-key="bq_pk_..." data-mode="sidebar" data-theme="auto" async ></script>
Dark-mode sync and full style control
The widget adapts to your site's color scheme automatically. Override any detail with data attributes or a custom stylesheet.
Dark-mode sync
The widget reads the host page's prefers-color-scheme media query and automatically switches between light and dark themes. No configuration needed — it matches your site the moment it loads.
CSS custom properties
Override any design token via data-bq-* attributes on the script tag or the Web Component. Change primary color, font, border radius, and spacing without writing custom CSS.
Font inheritance
By default the widget inherits your page's font-family so text renders consistently with your brand. Override with data-bq-font-family if you prefer a dedicated typeface.
Full CSS override
Inject a stylesheet URL via data-bq-style-url for complete visual control. Every element in the widget has a stable BEM class name documented in the style guide.
The keyboard shortcut developers expect
Enable command-palette mode and the widget registers a global Cmd+K (Mac) / Ctrl+K (Windows, Linux) listener. One keystroke opens the palette, another dismisses it. No mouse required.
- Global listener registered once — works from any page element
- Custom trigger key configurable via data-trigger-key attribute
- Dismisses on Esc; does not interfere with browser or OS shortcuts
- Renders above all page content with a backdrop overlay
- Instant search across indexed question history
- Arrow keys navigate; Enter expands the selected answer
Frequently Asked Questions
Common questions about the BeforeQuery website widget
Add AI to your site in one paste
Connect a knowledge source, grab your client key, and embed the widget. Dark mode, keyboard shortcuts, and citations — all included.