Skip to content

Feedback widget

The script widget shows a public feedback list, item details and a submission form. The SDK also has a smaller React-only submission dialog; it is not the same UI.

Embed the board

Create a public API key for a public organization, replace fb_pub_xxx, and place the config before the loader. The floating button appears after the board configuration loads.

<script>
  window.RefletFeedbackConfig = {
    publicKey: "fb_pub_xxx",
    theme: "auto",
    features: {
      createFeedback: true,
      voting: true,
      surveys: true
    }
  };
</script>
<script src="https://www.reflet.app/widget/reflet-feedback.v1.js" async></script>

Use a global config for a loader in the document head as well as at the end of the body. window.Reflet takes precedence over window.RefletFeedbackConfig; do not define both for this widget.

To display the board in a page region instead:

<div id="feedback-board"></div>
<script>
  window.RefletFeedbackConfig = {
    publicKey: "fb_pub_xxx",
    mode: "inline",
    targetId: "feedback-board",
    features: { createFeedback: true, voting: true }
  };
</script>
<script src="https://www.reflet.app/widget/reflet-feedback.v1.js" async></script>

Configuration

The loader also reads data-public-key, data-mode, data-position, data-theme and data-color from its script when initialization runs during script execution. It does not read data-key, user attributes or data-target-id. Global config avoids dependence on document.currentScript timing.

The type includes portal, locale, comments, roadmap and changelog options, but these are not complete controls in the current renderer. Portal has no automatic launcher, locale does not translate labels, comments are still rendered in details, and roadmap/changelog tabs reuse the feedback list. Do not use them as separate views or access controls.

Identity and access

The creation form requires user or userToken in config. Votes and comments require a verified signed userToken, not an unsigned user object. Generate the token on your server from the authenticated session, then include it in the config. Follow user signing; never expose the signing secret.

Public keys cannot read a private organization's board. The board UI stays hidden if configuration fails; surveys can still run. For anonymous reports or a private organization, use floating feedback or the React dialog below.

Methods and callbacks

// Run after the script has loaded and initialized.
const widget = window.__refletFeedbackWidgetInstance;
widget.open();
widget.close();
widget.track("checkout_completed");
const shown = await widget.showSurvey("survey_id");
widget.dismissSurvey();
// Remove a floating widget when its host page unmounts.
widget.destroy();

Set onOpen() and onClose() in the initial config for lifecycle events, onVote(feedbackId, voted) after a successful vote, and onFeedbackCreated(result) after creation. The result contains id and title. Callbacks are functions in global config, not script attributes. There is no runtime identity/config setter: recreate the widget when the signed-in account changes.

Surveys

Automatic delivery checks survey eligibility and triggers. track(eventName) fires custom-event triggers. showSurvey(id) returns Promise<boolean> and can show a manual survey; false means it cannot show now. Only one survey opens at a time. dismissSurvey() closes it and records dismissal.

The survey config accepts onSurveyStart, onQuestionAnswer, onSurveyComplete and onSurveyDismiss callbacks. Each receives an object with surveyId and event-specific fields: responseId/title, questionId/value, responseId/endingId, or responseId/answeredCount, respectively. Dismissed responseId can be null. For trigger rules, respondent storage and custom React UI, see surveys.

React submission dialog

npm install reflet-sdk
"use client";

import { FeedbackButton } from "reflet-sdk/react";

export function SendFeedback() {
  return <FeedbackButton publicKey="fb_pub_xxx" />;
}

FeedbackButton renders an inline trigger and a native dialog, not a floating board. It collects a required title and optional description/email, without screenshot or element capture. publicKey, user and userToken can come from RefletProvider. For controlled visibility:

"use client";

import { useState } from "react";
import { FeedbackDialog } from "reflet-sdk/react";

export function SendFeedback() {
  const [open, setOpen] = useState(false);
  return (
    <>
      <button type="button" onClick={() => setOpen(true)}>Send feedback</button>
      <FeedbackDialog
        publicKey="fb_pub_xxx"
        open={open}
        onOpenChange={setOpen}
      />
    </>
  );
}

Both accept theme (default auto), primaryColor, labels, baseUrl, onOpen, onClose and onSubmit(result). FeedbackButton also accepts className, children and asChild. With asChild, pass one accessible button; the component replaces that child's onClick rather than composing it. FeedbackDialog requires open and onOpenChange.

Limits and privacy

  • The board loads up to 50 feedback items sorted by votes. It has no pagination control.
  • The script creation form requires both title and description. Failed submissions show the API error. An attachment upload failure does not undo a created report.
  • Script screenshots serialize page HTML into an image. They do not use the floating React widget's markup filters or annotation tools. Check for sensitive content before offering capture.
  • Floating mode manages focus and Escape dismissal. Inline mode is not a modal. Keep the target visible and give its surrounding region an accessible heading.
  • Use one instance. With a changelog embed, initialize feedback first: changelog replaces window.Reflet and can prevent feedback's global config fallback from being read.

For origin restrictions and API errors, see the API reference.