React component

Import Answers from @bootstrapware/answers and the stylesheet once. The component uses hooks, so it belongs in a client boundary. The npm package is not published yet.

  • presentation defaults to launcher. Also section, modal, and window.
  • defaultOpen opens modal, window, and launcher. They start closed otherwise.
  • theme is optional light or dark. Omit it for the light cream default. The widget does not follow prefers-color-scheme.
  • pageContext is { url, title }. Omit it and the widget sends the current URL and document title. It does not send the DOM.
  • onFallback runs for an unanswered result. The widget does not render an answer body for that outcome.

Passing publishableKey without adapter shows "This page is not ready to answer yet." and does not fetch.

Related: Modes · React guide