Loading...
Installation
Usage
import {
RadioGroup,
SentimentCard,
} from "@/components/ruixen/sentiment-radio-group";
export default function App() {
return (
<div className="space-y-4">
<h2 className="text-lg font-semibold">How did it go?</h2>
<RadioGroup defaultValue="neutral">
<SentimentCard
value="angry"
emoji="😠"
title="Angry"
description="Frustrated or upset with the experience."
/>
<SentimentCard
value="sad"
emoji="🙁"
title="Sad"
description="Something didn't meet expectations."
/>
<SentimentCard
value="neutral"
emoji="😐"
title="Neutral"
description="Neither good nor bad, just okay."
/>
<SentimentCard
value="happy"
emoji="🙂"
title="Happy"
description="Satisfied and had a good experience."
/>
<SentimentCard
value="delighted"
emoji="😀"
title="Delighted"
description="Loved it, exceeded expectations!"
/>
</RadioGroup>
</div>
);
}
Props
RadioGroup Props
Prop | Type | Default | Description |
---|---|---|---|
className | string | - | Additional CSS classes |
defaultValue | string | - | Default selected value |
value | string | - | Controlled selected value |
onValueChange | (value: string) => void | - | Callback when value changes |
SentimentCard Props
Prop | Type | Default | Description |
---|---|---|---|
value | string | - | Unique value for this option |
emoji | string | - | Emoji character to display |
title | string | - | Card title text |
description | string | - | Optional description text |
className | string | - | Additional CSS classes |
Features
- Sentiment Collection: Perfect for gathering user feedback and satisfaction ratings
- Visual Feedback: Large emojis provide immediate visual context
- Descriptive Text: Titles and descriptions help users understand each option
- Accessible: Built on Radix UI primitives with proper keyboard navigation
- Customizable: Easy to style and extend with additional sentiment options
Use Cases
- Customer Feedback: Post-purchase or post-service satisfaction surveys
- User Experience: Gathering feedback on app features or interactions
- Content Rating: Rating articles, videos, or other content
- Mood Tracking: Personal wellness or mood tracking applications
- Event Feedback: Conference, workshop, or event satisfaction surveys