logaretm / vee-validate

✅ Painless Vue forms
https://vee-validate.logaretm.com/v4
MIT License
10.66k stars 1.25k forks source link

not render a span/div #1982

Closed uncleGena closed 5 years ago

uncleGena commented 5 years ago

here is a sentence which says

By default, ValidationProvider renders a span, meaning it does not render anything of its own.

While I cant understand that sentence, I have a small hope that there is a way to remove that wrapper element. Is there any problem to do renderless component? Or at least provide a class attribute to ValidationProvider?

logaretm commented 5 years ago

This is a left-over sentence from the old behavior, sorry about that.

There are a couple of things that prevented vee-validate from keeping those components renderless:

This means that vee-validate had to force the users to keep in mind that they must have 1 root element inside the provider and prevent them from using template tags since they always have more than 1 root element. This would make vee-validate incompatible with 50% of API and not intuitive for the new developers since it would have too many caveats for my taste.

Anyways, regarding your issue. Providers and observers tags can be customized using the tag prop, and they inherit any attrs added on them, so you can add class or style and it would not block those attrs.

Here is an example, where I used both class and style and it proxied properly to the div tag I specified.

https://codesandbox.io/s/1rmn5j5q8l

I will make sure to fix the docs sentence.

uncleGena commented 5 years ago

so you can add class or style and it would not block those attrs.

Good! I thought I've checked that right. Must be my mistake... Thank you.