-
Notifications
You must be signed in to change notification settings - Fork 985
feat(InputRating): add input rating component #5757
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: v4
Are you sure you want to change the base?
Conversation
|
Idk if change the name of component. Simply "rating" instead of "star-rating"? |
commit: |
|
Thanks, @solidusite. About the component name, Iβd prefer Why:
Given itβs a new component, I think this is the best moment to align naming before release. |
Totally agree |
4a530bd to
25a1799
Compare
25a1799 to
8f499f4
Compare
8f499f4 to
12b81cc
Compare
|
We were waiting for this to be implemented in Reka UI to handle all complex logic such as form validation: unovue/reka-ui#1968 @J-Michalek What do you think? |
J-Michalek
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@benjamincanac I would like to get this component done one day because there definitely are some users that want this, but I think we either need to wait for the RekaUI solution or create it ourselves based on the RadioGroup component.
The current implementation shown in this PR is not accessible at all and it seems there is no input so there are most likely issues with native form behavior.
|
I completely understand, thanks for the clarification. That said, if youβd prefer to move forward sooner and have some guidance on the expected direction (for example, reworking this on top of RadioGroup to ensure proper accessibility and native form behavior), Iβd be happy to iterate on the component accordingly. |
|
I think it's worth iterating on your PR since you've done most of the job already to use the Reka UI RadioGroup component, it comes down to the same thing as using Rating primitives that use RadioGroup underneath. |
|
I made some improvements @benjamincanac Refactoring with RadioGroupItem
Disabled vs Readonly StatesRefactored the disabled/readonly logic for better clarity and visual distinction:
The component now properly separates functional disabled state (which includes readonly for interaction blocking) from visual disabled state (only when explicitly disabled). Accessibility Improvements
Additional Changes
Registrazione.schermo.2026-01-06.alle.15.48.20.mov |
c0fa99d to
30293ab
Compare
β¦e component with readonly and disabled states, add focus ring customization, and improve documentation
β¦timize stars state computation and props handling - Remove separate computed for stars and inline logic into `starsWithState` using Array.from - Precompute steps inside `starsWithState` and remove `getStepsForStar` - Use `star.steps` in the template instead of calling a function per star - Remove redundant fallback in `currentValue` (useVModel already handles `defaultValue`) - Add optional `orientation` prop with default `horizontal` and use it in the template
30293ab to
5581bae
Compare
| > | ||
| <UIcon | ||
| :name="starIcon" | ||
| :class="[ui.icon({ class: props.ui?.icon }), ui.starHalf({ class: props.ui?.starHalf })]" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| :class="[ui.icon({ class: props.ui?.icon }), ui.starHalf({ class: props.ui?.starHalf })]" | |
| :class="ui.icon({ class: props.ui?.icon })" |
The icon inside the half-star overlay div is incorrectly applying both the icon and starHalf UI classes, causing duplicate clip-path styling.
View Details
Analysis
Duplicate UI class styling on half-star icon in InputRating component
What fails: The UIcon component inside the starHalf overlay div (line 241) incorrectly applies both ui.icon() and ui.starHalf() classes, causing redundant and semantically incorrect styling to be applied to the icon element.
How to reproduce:
<!-- Before fix - line 241 in src/runtime/components/InputRating.vue -->
<UIcon
:name="starIcon"
:class="[ui.icon({ class: props.ui?.icon }), ui.starHalf({ class: props.ui?.starHalf })]"
/>Render the InputRating component with allowHalf: true and a half-star rating (e.g., 3.5).
Result: The icon element receives the ui.starHalf() class styling which includes:
absolute inset-0 pointer-events-none overflow-hidden [clip-path:polygon(...)] [-webkit-clip-path:polygon(...)]
These are container-level styles already applied to the parent div.
Expected: The icon should only receive ui.icon() styling (w-full h-full), matching the pattern used for:
- The filled star icon (line 229)
- The empty star icon (line 221)
The parent container provides the clip-path clipping - the child icon element should not reapply container styles.
Fix applied: Changed line 241 to only apply ui.icon():
:class="ui.icon({ class: props.ui?.icon })"This restores consistency across all star variants and removes unnecessary stacking context creation from the redundant clip-path declaration.
add star rating component with customizable props
π Linked issue
Resolves #505
β Type of change
π Description
A component to display and collect star ratings from users.

π Checklist