Create a rating component showcase with star animations, half-star support, custom icons, hover preview, and satisfying selection feedback.
Assistant
Good, cn util with clsx/tailwind-merge is available. Now let me build the core reusable Rating component, plus a particle-burst effect component, and a showcase App page.
Now let's add keyframe animations to index.css.
Fix the type inference issue by explicitly typing the values state as number[].
Now update the page title in index.html and rebuild.
Build succeeded. Here's a summary of what I built:
A full rating component showcase with a reusable Rating component (src/components/Rating.tsx) featuring:
Half-star precision — clicking the left half of an icon selects a value, rendered via SVG gradient clipping
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.
Custom icon support — pluggable icon renderer with built-in Star, Heart, Thumb, and Bolt icons, all supporting fill/half-fill states
Hover preview — live preview of the value under the cursor with a staggered scale animation across icons, without committing until click
Selection feedback — a spring "pop" keyframe animation plus a radiating particle burst on click for tactile satisfaction
Configurable size, color, gap, read-only/disabled states, and optional value label
Showcase page (src/App.tsx) demonstrating it in context:
Hero with a read-only 5-star display
Basic hover/click demo with animated label text
Half-star precision demo
Icon gallery (stars, hearts, thumbs, bolts) with independent state
Size & color customization panel
Read-only review cards
Aggregate rating summary with distribution bars
A working feedback form flow with a success confirmation state
Custom CSS keyframes (rating-pop, rating-particle, fade-in, glow-pulse) were added to index.css to power the animations. Page title updated, and the project builds successfully.