daief / daisyui-vue

(WIP) Vue3 UI components based on daisyui.
https://daief.tech/daisyui-vue/components/button
Apache License 2.0
163 stars 9 forks source link

change the name of the prop 'type' #2

Closed arily closed 1 year ago

arily commented 1 year ago

https://stackoverflow.com/questions/2825856/html-button-to-not-submit-form

form>button has to explicitly set type to button to prevent the form from submitting, but the type keyword is already used for picking variants.

please consider changing the key of the type prop to something else, maybe something like variant

daief commented 1 year ago

Thanks for your reminder. I want to add a htmlType prop. It is a common way to handle original html type in some other library like antd.

arily commented 1 year ago

I would suggest avoiding handling HTML attributes manually, that's a lot of additional work. also, the component will be web-component compatible. bootstrap-vue uses the variant keyword to specify the color scheme.

daief commented 1 year ago

I can agree with you. But it is customary for many people to use type as the theme type control for buttons. I have no intention of changing it. And in my experience, we will hande HTML attributes manually only in a few cases.

arily commented 1 year ago

https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes here is the list for html attributes. By manually handle few selected one you may creating more inconsistent between handled and unhandled attrs.

daief commented 1 year ago

Ok. I will change type to variant.

daief commented 1 year ago

Done: https://github.com/daief/daisyui-vue/commit/b44509ed22d96e1f2d0c368873211f8dc333cff0