Skip to content
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

[Feature Request] Prop rules for VRating #20887

Closed
frederikheld opened this issue Jan 20, 2025 · 5 comments
Closed

[Feature Request] Prop rules for VRating #20887

frederikheld opened this issue Jan 20, 2025 · 5 comments

Comments

@frederikheld
Copy link
Contributor

frederikheld commented Jan 20, 2025

Problem to solve

VRating does not have a rules prop as other inputs have. If I want to validate the VRating input, I have to use the following workaround:

<v-rating model="inputStars" />
<!-- the hidden input checks the rule because v-rating does not take rules -->
<v-input
  type="number"
  v-model="inputStars"
  :rules="[(v: number | undefined) => v !== undefined]"
  style="display: none"
/>

It works, but it would be great if this workaround would be unnecessary.

Proposed solution

Add a property rules to VRating that works analog to the other inputs.

@frederikheld frederikheld changed the title [Feature Request] rules prop for VRating [Feature Request] Prop rules for VRating Jan 20, 2025
@b-maslennikov
Copy link

use v-validation

example

@frederikheld
Copy link
Contributor Author

frederikheld commented Jan 20, 2025

I'm not looking for more workarounds, I'm looking for a consistent API across all user inputs.

But thanks for showing me that this exists. Might become useful for custom user input components.

@MatthewAry
Copy link
Contributor

Ah, well VRating is not a treated like or classified as a form input field in Vuetify. It inherits from VBtn instead of VInput. As such @b-maslennikov is giving you the best solution.

Also @b-maslennikov I didn't know about the VValidation component! I would always extend off of the VInput component. This will make things easier for me in the future. 👌

@MatthewAry MatthewAry added T: enhancement Functionality that enhances existing features C: VRating E: validation labels Jan 21, 2025
@KaelWD KaelWD closed this as not planned Won't fix, can't repro, duplicate, stale Jan 21, 2025
@KaelWD KaelWD removed T: enhancement Functionality that enhances existing features C: VRating E: validation labels Jan 21, 2025
@frederikheld
Copy link
Contributor Author

Interesting approach. Thanks for sharing.

I don't understand why you make a difference between form inputs and other interactive elements that take user input, but ok.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants