Open mattgreenfield opened 5 years ago
@mattgreenfield yes I am open to this idea. We are recently adding a special <Input>
component to our own design library internally at my day job so interested as well.
There could be some issues with making sure it binds correctly to all the properties. With slots there is the drawback that you have to pass a ton of required internal scope-slot props: https://github.com/darrenjennings/vue-autosuggest/blob/458f3e227d8048c84ba40e2045b9565c565d37a0/src/Autosuggest.vue#L4-L17
It's possible that you could make this <component :is="inputProps.tag"
which would then allow users to pass the tag they want. We already have inputProps
and any listeners already bind to the <input>
so if your special input component has any strange props or needs this should work with minimal effort. inputProps
could have "tag" similar to how vue-router implements it, though there is an RFC that discusses the benefits/drawbacks of the tag prop WRT slots. I think they have less slot properties than we do especially concerning aria-attributes, and they do not already have an API for binding properties and listeners to their anchor tag so I think it is OK for vue-autosuggest to have another custom inputProps
property called tag
. Open to discussion, but PR is welcome!
I have a library of components, including a text input. It would be nice if I could use this instead of having to style the current input to match.
The nicest way would be to do this via slots.
Is this something you would consider? I'm happy to have a look and submit a PR.
Thanks,