Strata
Back to Strata

Documentation

Widget integration guide and API reference for <strata-chat>

Try the live widget (floating button). It uses workspace strata-docs so you can ask about this documentation.

Quick Start

Add the Strata widget in 2 lines of code. Takes less than 5 minutes to go live.

  1. Create an account – Sign up at strata.fyi/onboard.
  2. Add the widget – Paste the two lines below into your HTML.
  3. Upload documents – Add FAQs, policies, and knowledge base content in the dashboard.
  4. Go live – The widget is ready.

Install

Add these two lines to your HTML. The script loads a lightweight launcher that renders the chat inside an iframe (isolated; no CSS conflicts with your page).

<script src="https://strata.fyi/widget.js" defer></script> <strata-chat workspace="your-workspace"></strata-chat>

Replace your-workspace with your workspace slug from the Strata dashboard.

Advanced: manual iframe embed

If you need full control over the iframe, you can embed it directly instead of using the script loader.

<link rel="stylesheet" href="https://strata.fyi/embed/widget.css"> <div class="strata-chat-widget"> <iframe src="https://strata.fyi/embed?workspace=your-workspace" loading="lazy" allow="clipboard-write" ></iframe> </div>

Host-controlled launcher (recommended for custom UI)

If your site already has its own Open AI / Close AI controls, set launcher="hidden". This removes the floating Strata launcher and avoids overlap/state-conflict issues.

<script src="https://strata.fyi/widget.js" defer></script> <strata-chat workspace="your-workspace" launcher="hidden"></strata-chat> <button id="open-ai">Open AI agent</button> <button id="close-ai">Close AI agent</button> <script> document.getElementById('open-ai')?.addEventListener('click', () => window.StrataChat?.open?.()) document.getElementById('close-ai')?.addEventListener('click', () => window.StrataChat?.close?.()) // Keep host UI labels in sync with chat state const unsubscribe = window.StrataChat?.onStateChange?.(({ isOpen }) => { // update host controls here }) // Call unsubscribe() when cleaning up SPA routes if needed. </script>

API methods: open(), close(), toggle(), setVisibility(boolean), and onStateChange(listener).

Widget Attributes

Customize the <strata-chat> element with these attributes. All attributes use kebab-case (e.g. api-url, chat-title).

AttributeTypeDefaultDescription
workspace requiredstringN/AYour workspace slug. Determines which knowledge base and users the chat connects to. Get this from your Strata dashboard after creating a workspace. (Legacy: tenant is also supported.)
api-urlstringhttps://strata.fyiOverride the Strata API base URL. Use for local development (e.g. http://localhost:3000) or self-hosted deployments.
icon-urlstringStrata defaultURL of a custom icon image for the chat bubble. Use a square image (e.g. 256×256) for best results.
chat-titlestringStrataTitle shown in the chat header when the panel is open.
show-headerbooleantrueShow the header bar when chat is open. Set to "false" to hide.
show-notificationsbooleanfalseShow notification badge on the chat bubble. Set to "true" to enable.
backgroundstringglassPanel background style. "glass" for translucent, "none" for transparent.
hide-brandingbooleanfalseHide the "Powered by Strata" footer. Set to "true" for white-label.
launcher"auto" | "hidden"autoLauncher mode. Use "hidden" when your site already has its own Open/Close AI buttons and you want to control chat via window.StrataChat.open()/close()/toggle().
welcome-messagestringHi! Ask me anything. I can summarize content, answer questions, or use documents you upload to improve my answers.Custom intro message shown when the chat opens. Override to match your brand or use case.
suggested-promptsstringHow can you help?, Summarize a document, Search my docsComma-separated prompt chips shown on the welcome screen. Use JSON array for prompts with commas.
display-confidencebooleanfalseShow confidence score pill in assistant messages. Use for dev/test or analytics dashboards.

Examples

Pick an attribute to see a minimal <strata-chat> snippet and a visual. Live values also match /demo.

Custom launcher icon

Set icon-url to a square image (PNG or SVG). Used for the floating button and the avatars in the panel.

<strata-chat workspace="your-workspace" icon-url="https://example.com/logo.png" ></strata-chat>

Default

Default Strata launcher

With icon-url

Launcher after setting icon-url

Workspace slug

The workspace attribute is your workspace slug: the unique identifier you choose when creating a workspace in the Strata dashboard. It determines which knowledge base, documents, and user context the chat uses. For example, if your workspace slug is acme-support, use workspace="acme-support".

Legacy: The tenant attribute is still supported for backward compatibility.