Preact

Feedback widget
for Preact.

Use the React component through preact/compat, or the vanilla init.

Preact aliases react to preact/compat in most setups, so @usero/sdk/react resolves to the Preact runtime without extra work. If you would rather skip compat, the vanilla init from a useEffect works just as well.

~12kb
gzipped
0
config
MIT
license
Install2 steps
> ~ install· bash
npm install @usero/sdk
> src/app.tsx· tsx
// Preact aliases 'react' -> 'preact/compat' in vite.config / tsconfig,
// so the React build of the widget runs on Preact unchanged.
import { UseroFeedbackWidget } from '@usero/sdk/react'

export function App() {
  return (
    <>
      {/* your app */}
      <UseroFeedbackWidget clientId='YOUR_CLIENT_ID' />
    </>
  )
}

Replace YOUR_CLIENT_ID with the id from your Usero dashboard.

Built for Preact

Why teams shipping with Preact pick Usero.

preact/compat carries the React build

When react and react-dom are aliased to preact/compat (the standard @preact/preset-vite setup), @usero/sdk/react imports resolve to Preact, no shim of our own needed.

Or skip compat with the vanilla init

If you do not alias react, import initUseroFeedbackWidget from @usero/sdk and call it from a useEffect with an empty dependency array. Same widget, no compat layer.

Tiny next to Preact itself

Preact is about 3kb, the widget about 12kb gzipped. Both stay small, which is the reason most people reach for Preact in the first place.

Hooks work as-is

preact/compat provides useState and useEffect, which is all the React build of the widget uses internally. Nothing exotic to alias.

Canny embeds a heavy iframe that dwarfs a Preact bundle. The widget adds about 12kb, in the same weight class as Preact itself.
vs Canny embed

FAQ

Quick answers, Preact edition.

Does @usero/sdk/react work on Preact?

Yes, when react and react-dom are aliased to preact/compat, which the default Preact Vite preset does. The React component then runs on the Preact runtime unchanged.

What if I do not want the compat alias?

Use the vanilla build instead. Import initUseroFeedbackWidget from @usero/sdk and call it inside a useEffect(() => {...}, []) so it boots once on mount.

Will the bundle stay small?

Yes. The base widget is about 12kb gzipped and the session-replay plugin is a separate chunk that only loads if you import it.

Does this cover Preact with htm or no-build setups?

For no-build htm pages, use the script-tag install instead and call Usero.initUseroFeedbackWidget from a plain script.

Ship a feedback widget in your Preact app today.

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

Get started free