When we try to fill forms in the internet, required fields are marked using a red color ' * ' mark to indicate that the field is a must.
Like that is there a way to indicate users to required fields in vuetify.js?
When we try to fill forms in the internet, required fields are marked using a red color ' * ' mark to indicate that the field is a must.
Like that is there a way to indicate users to required fields in vuetify.js?
From v1.1.0 docs:
So apparently nothing will set it as required anymore, we have to add it manually in the label:
Or you could use CSS:
Tho you must add
required
class manually (name of the class is arbitrary of course).Performance wise, I don't know if this is the best solution. But it works.
Import the JavaScript file bellow into you application bootstrap (or something like that).
Nuxt.js: put the file above into the
plugins
folder. Include its path on theplugins
array on thenuxt.config.js
file.Add the rule bellow to your global CSS / theme.
You are able to pass a rules prop to a
v-text-field
.E.g,
See this Vuetify example for a fuller picture: https://github.com/vuetifyjs/vuetifyjs.com/blob/master/src/examples/text-fields/validation.vue
required
is also an HTML property. You could just add it to the HTML Element like this:It's a bit of a pain, but there is a 'label' named slot and you can do something like this: