I am using vee-validate v3.0 to do my validation and the setup went well, but now I am trying to style my elements but I can't seem to get it working. I followed the very short documentation about styling and edited the vee-validate config, but I noticed that the v-slot was now changed to classes. This confused me because the v-slot was already used for errors, can I use multiple? I want the input field to use the input.valid and input.invalid.
https://logaretm.github.io/vee-validate/guide/styling.html#classes
Form in Vue Register component
<ValidationProvider rules="required|min" v-slot="{ errors, classes }">
<input
v-model="form.username"
type="text"
id="username"
class="fadeIn second"
:class="classes"
name="login"
placeholder="username"
/>
<span class="form-error">{{ errors[0] }}</span>
</ValidationProvider>
Style in Vue Register component
<style>
input.invalid {
color: red;
}
input.valid {
color: green;
}
</style>
Config
import { configure } from "vee-validate";
configure({
classes: {
valid: "is-valid",
invalid: "is-invalid"
}
});
is-validandis-invalidas class names but then you've gotvalidandinvalidin your CSS. - skirtleis-invalidon the DOM element (as it seems you are) then that means you've configured a custom CSS class. You need to update the CSS selector to match the classes you have configured. - skirtle