Logoaber-ui

AI Feedback Collector

A component for collecting user feedback on AI-generated content.

Installation

npx shadcn@latest add "https://haberui.com/h/ai-feedback-collector.json"

Basic Usage

Basic Usage

Was this response helpful?

Comments Support

Enable users to provide text feedback for more detailed responses.

With Comments

Did this answer help you?

Customization

Style Variants

Style Variants

Default

Was this response helpful?

Minimal

Was this response helpful?

Card

Was this response helpful?

Color Schemes

Color Schemes

Default

Was this response helpful?

Blue

Was this response helpful?

Green

Was this response helpful?

Purple

Was this response helpful?

Amber

Was this response helpful?

Size Variants

Size Variants

Small

Was this response helpful?

Medium (Default)

Was this response helpful?

Large

Was this response helpful?

Custom Icons

Custom Icons

Rate this response
How was this answer?

Integration Examples

Chat UI Integration

Chat Integration

The GDP of France was approximately €2.5 trillion in 2022, making it the 7th largest economy in the world.
Was this helpful?

Props

PropTypeDefault
variant?
"default" | "minimal" | "card"
"default"
size?
"sm" | "md" | "lg"
"md"
colorScheme?
"default" | "blue" | "green" | "amber" | "purple"
"default"
onFeedback?
(feedback: { type: "positive" | "negative" | null; comment?: string }) => void | Promise<void>
-
allowComments?
boolean
false
commentsOnNegativeOnly?
boolean
true
promptText?
string
"Was this response helpful?"
thanksText?
string
"Thanks for your feedback!"
commentPromptText?
string
"Would you like to add a comment?"
commentPlaceholder?
string
"What could be improved?"
commentSubmitText?
string
"Send"
submittingText?
string
"Sending..."
positiveIcon?
React.ReactNode
<ThumbsUp />
negativeIcon?
React.ReactNode
<ThumbsDown />
buttonClassName?
string
-
activeButtonClassName?
string
-
commentFieldClassName?
string
-

Usage Example

import { AIFeedbackCollector } from "@/components/haber-ui/ai-feedback-collector";
 
export function AIResponseWithFeedback() {
  const handleFeedback = async (feedback) => {
    console.log("User feedback:", feedback);
 
    // Example: Send feedback to your API
    await fetch("/api/feedback", {
      method: "POST",
      body: JSON.stringify(feedback),
    });
  };
 
  return (
    <div className="space-y-4">
      <div className="p-4 rounded-lg bg-card">
        <p>
          The capital of France is Paris, which is located on the Seine River
          and has a population of over 2 million people.
        </p>
      </div>
 
      <AIFeedbackCollector
        onFeedback={handleFeedback}
        allowComments={true}
        colorScheme="blue"
        size="sm"
      />
    </div>
  );
}

On this page