Feedback & States
Star Rating
Five SVG stars fill green from a clipped well with spring stagger on hover and commit; shake animation and red flash for denied state, status readout below.
svgmedium complexitymoderate motionpointermobile-ready
Open on the canvas to copy the code → Free account · 3 copies a day · membership goes unlimited
1
When to use it
Review forms, product ratings, feedback widgets needing tactile feel with success/error state communication.
When not to
Read-only display contexts or anywhere the auto-demo loop would conflict with real user state — remove the SEQ demo timer before shipping.
Working with an AI agent
Every component ships agent-ready metadata. An example instruction for this one:
Change accent color from green to amber by setting --fb11-ac to #f59e0b and --fb11-ac2 to #d97706, and increase star count N to 10. Theme: dark tokens live in :root, the light variant in :root[data-theme="light"]; ?theme=light or a {type:'forever:theme'} postMessage switches at runtime.
Safe to edit
- star count (N=5)
- accent color (--fb11-ac, --fb11-ac2)
- error color (--fb11-err)
- spring stagger step (STEP=0.07)
- demo sequence timings (SEQ[].t values)
- idle demo cadence while demoEnabled; first deliberate input disables it permanently
- theme tokens (:root dark defaults + [data-theme=light] overrides)
Keep intact
- SVG clipPath per star (critical for fill-from-bottom illusion)
- IIFE wrapper
- prefers-reduced-motion guard with static fallback
- visibilitychange pause
- aria-valuenow updates + role=slider
- theme hook (?theme= bootstrap + forever:theme message listener + theme tokens)
- demo-v1 preview lifecycle: initialize demoEnabled from window.__foreverPreview and stop attract work on the window forever:interactive event; retain manual feedback, settling, cleanup and explicit sessions
Known limitations
- First deliberate input permanently disables idle demo; manual input, finite feedback and settling remain active. Host demoEnabled=false skips the initial attract cycle.
- deny() is wired to Enter/Space key in demo but has no real trigger condition to customize
- Star count change requires updating N only; aria-valuemax must also be updated manually
- State remains local to each mounted instance; format/theme remount preserves takeover, not component values.
More Feedback & States components
- Success CheckMint-green ring sweeps closed and a checkmark draws in with a springy pop and expanding halo; initial replay stops after first input; click or Space runs…
- Error ShakeDark email input shakes horizontally with decaying-sine, border flushes red, X icon pops in with overshoot spring, validation message slides up.
- Toast StackDark notification toasts spring up from the bottom, drain a colored progress bar, then slide off right. Four types cycle: success, error, warning,…
- Hold to ConfirmPress-and-hold fills a tick-marked ring; full hold rotates center square 45° into a green check; early release flashes red cross (cancelled).
- Empty StateA Bauhaus open vessel sits empty while 26 mint motes drift in a slow orbital cloud above it; poking scatters them and they spring back to settle.
- Like BurstRose-and-verdigris enamel palette: a heart spring-pops with 96 dots and ring shards. First input stops the demo; later input toggles the liked state.