Inputs & Switches
Star Rating
Five gold SVG star radio controls commit ratings on click or keyboard input and settle with a scale bounce. First input stops automatic sweeping.
svglight complexitymoderate motionhover
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 cards, feedback widgets — anywhere a star rating input needs a lively, self-demonstrating idle state.
When not to
Production forms requiring a fixed, committed rating — the auto-cycle must be removed and a click-to-set handler added before shipping.
Working with an AI agent
Every component ships agent-ready metadata. An example instruction for this one:
Change star count to 10 by setting N=10 and adjusting the viewBox to "0 0 640 80", update spacing from 62 to 62, and change gold color from #ffd23f to #f59e0b. 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)
- star color (#ffd23f)
- auto-sweep speed (clock%18)
- pop scale amount (1.25)
- star spacing (i*62)
- theme tokens (:root dark defaults + [data-theme=light] overrides)
Keep intact
- IIFE wrapper
- prefers-reduced-motion static fallback
- visibilitychange pause
- SVG role/aria-label
- 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.
- Star radio controls support Space/Enter and arrow keys; committed rating remains until changed or reload.
- State remains local to each mounted instance; format/theme remount preserves takeover, not component values.
More Inputs & Switches components
- Liquid ToggleSVG liquid toggle with a goo filter, trailing droplets and a native button. First deliberate input stops the idle demo; the chosen on/off state settles fully.
- Glow SliderSVG range slider with a muted plum-to-teal fill, glow and value bubble, driven by a native range input. First input stops demo oscillation; drag and…
- Spring StepperMint stepper with native minus/plus buttons and a number reel that settles with spring feedback. First deliberate input stops automatic steps; the chosen…
- Segmented ControlSlate-to-sage pill slides between four native segment buttons with elastic spring stretch. First input stops automatic cycling; committed selection remains.
- Checkbox MorphThree native amber checkbox buttons animate their check strokes and expose pressed state. First input stops the demo; checked values remain.
- OTP BoxesFour native numeric OTP inputs support typing, paste, focus advance and Backspace navigation. Initial digits are populated; first input stops scripted entry.