Docusaurus

Feedback widget
for Docusaurus.

Add the SDK via the scripts array in docusaurus.config.js.

Docusaurus has a first-class scripts option in its config, so you do not have to swizzle a component. Add the SDK script there and a small client module to call init, and the widget ships on every docs page.

~12kb
gzipped
0
config
MIT
license
Install3 steps
> ~ install· bash
npm install @usero/sdk
> src/clientModules/usero.js· js
import { initUseroFeedbackWidget } from '@usero/sdk'

let widget
export function onRouteDidUpdate() {
  if (widget) return
  widget = initUseroFeedbackWidget({ clientId: 'YOUR_CLIENT_ID' })
}
> docusaurus.config.js· js
export default {
  // ...
  clientModules: [require.resolve('./src/clientModules/usero.js')],
}

Replace YOUR_CLIENT_ID with the id from your Usero dashboard.

Built for Docusaurus

Why teams shipping with Docusaurus pick Usero.

Client module, not a swizzle

Docusaurus clientModules run in the browser on every route. Registering one is cleaner than swizzling the Layout component just to add a script.

Init-once guard

onRouteDidUpdate fires on every navigation. The widget guard variable ensures it initializes a single time, not once per docs page view.

SSR-safe

Client modules only run in the browser. The static HTML Docusaurus builds for SEO never executes the widget code.

Survives the docs SPA navigation

Docusaurus is a single-page app after first load. The init-once guard keeps the widget alive as readers click between docs.

Featurebase loads a script and waits for a mount target. The vanilla SDK renders its own trigger from the init call, ideal for a docs SPA.
vs Featurebase widget

FAQ

Quick answers, Docusaurus edition.

Do I have to swizzle a component?

No. Use a client module registered in clientModules. It runs in the browser on every route, which is simpler and update-safe compared to swizzling Layout.

Why the init-once guard?

onRouteDidUpdate fires on every navigation. Without the guard you would create a new widget per page view. The guard keeps exactly one instance.

Does it break the static build?

No. Client modules only execute in the browser, so the prerendered HTML Docusaurus generates for search engines is unaffected.

Can I scope it to docs only?

Yes. Read the location inside onRouteDidUpdate and only call init when the path starts with your docs base path.

Ship a feedback widget in your Docusaurus app today.

Free tier. No credit card. Two-minute install. Cancel by deleting two lines of code.

Get started free