Vuetify: Feature request: maxlength attribute support on v-text-field (input, textarea)

Created on 10 Apr 2017  ·  9Comments  ·  Source: vuetifyjs/vuetify

What will it allow you to do that you can't do today?

Limit the amount of characters that can be entered into input and textarea fields.

How will it make current work-arounds straightforward?

Not aware of a current work-around.

What potential bugs and edge cases does it help to avoid?

To enforce a character max length where using a counter is not feasible such as for single line text inputs.
It also helps to keep the user interface snappy and is nice to have because it can provide basic protection against bloating requests.

enhancement

Most helpful comment

@KaelWD Perhaps you could add a note saying something along the lines of "all normal html tags are supported in a v-text-field" to remove confusion. Vue and Vuetify does so much that its not always obvious that you can.

All 9 comments

Thanks @johnleider

TODO: document this on https://vuetifyjs.com/en/components/text-fields#api
this feature works fine and i like it a lot, but i was unable to find this in the docs.
it can help more people if it is documented 😉

We are always looking for additional help with the documentation!

maxlength is a built-in html attribute, it'd be retarded to list every single one of those in our documentation.

@KaelWD Perhaps you could add a note saying something along the lines of "all normal html tags are supported in a v-text-field" to remove confusion. Vue and Vuetify does so much that its not always obvious that you can.

Good idea, not a good repo ;) Please create issue in vuetiyjs.com repo

好主意,不是一个好的回购;)请在vuetiyjs.com回购中创建问题

为什么v-text-field type=number时 不支持maxlength属性

Because input[type="number"] doesn't support it https://developer.mozilla.org/pl/docs/Web/HTML/Element/Input#attr-maxlength

you may use type="tel" instead of type="number"

Was this page helpful?
0 / 5 - 0 ratings