Skip to main content

createFeedback(options)

Returns a client with mount, open, capture, send, and destroy. It does not mount UI, capture a screenshot, or send a report on initialization.
The constructor rejects a missing/empty endpoint or an invalid timeout. It is safe to call during SSR, but initialize in client lifecycle code if you will mount UI. Endpoint correctness, authentication and project authorization belong to your application.

mount(): void

Adds one floating Report an issue button to the bottom-right of the page. Repeated calls on the same client do not add duplicates. Use one client per app to avoid multiple widgets. The launcher and dialog use Shadow DOM styling.

open(): void

Opens the native modal dialog and starts capture. Calling it again while open focuses the existing dialog. The user can retake, add a description, submit, or cancel. Escape closes the dialog when it is not busy. Sending disables controls until delivery succeeds or fails. open() returns immediately; it is not a promise that resolves when a report is sent. This release has no onSuccess, onError, theme, position or text customization options. Use the headless methods for those requirements.

capture(): Promise<Capture>

Renders the visible webpage to a PNG Blob and returns its context. It does not send data to the feedback endpoint. Screenshot rendering may load page resources, such as images, as part of rendering.
The URL includes origin and path but excludes search/hash. Image scale is capped at 2; the context records the device’s original pixel ratio. Capture can reject if rendering fails, if a PNG cannot be created, or if the image exceeds 5 MiB. There is no public crop, annotation, quality or capture-timeout option.

send(report): Promise<Response>

Trims the text, validates it and the screenshot, creates FormData and sends a POST. If context is omitted, {} is sent. A screenshot is required; text-only feedback is not supported. Resolves with the Fetch Response for any 2xx status. The library does not parse the body. Only call response.json() if your server actually returns JSON; a 204 response has no JSON body. Rejects for invalid input, network/CORS failures, timeout/abort, or non-2xx HTTP status. Errors are standard JavaScript errors without a stable custom error-code API. HTTP failures include the status code in the message. Server error bodies are not displayed by the default widget. Limits: 1–5000 trimmed text characters; a nonempty PNG Blob no larger than 5 × 1024 × 1024 bytes. Client validation checks Blob type/size, not actual PNG decoding. Your server must validate independently. Requests use credentials: 'omit'. Cookie-based sessions are not sent, including on the same origin. You may use a short-lived scoped token in headers; never embed a privileged server key. There is no automatic retry or deduplication.

destroy(): void

Removes this client’s UI, revokes its screenshot preview URL and aborts pending uploads. Repeated calls are safe. All future UI/capture/send calls on that client reject or throw; create a new client to restart. In-progress rendering is not immediately cancellable, but its result is discarded after teardown. Call this from React effect cleanup or equivalent app teardown code. If you use custom object URLs for screenshots, revoke those separately.

TypeScript exports

FeedbackContext, Capture, FeedbackOptions, and FeedbackClient are exported types. The runtime named export is createFeedback.