daisyui / react-daisyui

daisyUI components built with React 🌼
http://react.daisyui.com/
MIT License
943 stars 103 forks source link

dropdown toggle default button type #255

Closed muametgrooby closed 1 year ago

muametgrooby commented 1 year ago

Hello everyone, usually I'd create an issue for something like this, but since the change is trivial I thought I'd file a PR instead, I do not think the default button type of "submit" makes sense for dropdown toggles, you do not want it to submit a form and I don't think there'd be an use case where someone may need to set it to anything other than "button", this is why I didn't add a prop.

netlify[bot] commented 1 year ago

Deploy Preview for react-daisyui ready!

Name Link
Latest commit 0b6606726ae74a1f490207112b171afacfae9f17
Latest deploy log https://app.netlify.com/sites/react-daisyui/deploys/6379582d2514fc0008193803
Deploy Preview https://deploy-preview-255--react-daisyui.netlify.app
Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

netlify[bot] commented 1 year ago

Deploy Preview for react-daisyui processing.

Name Link
Latest commit 0b6606726ae74a1f490207112b171afacfae9f17
Latest deploy log https://app.netlify.com/sites/react-daisyui/deploys/6379582d2514fc0008193803
netlify[bot] commented 1 year ago

Deploy Preview for react-daisyui processing.

Name Link
Latest commit 0b6606726ae74a1f490207112b171afacfae9f17
Latest deploy log https://app.netlify.com/sites/react-daisyui/deploys/6379582d2514fc0008193803
benjitrosch commented 1 year ago

@muametgrooby thanks for the PR, makes sense to me. However, would it be better to add the default type to the Button component itself?

muametgrooby commented 1 year ago

@muametgrooby thanks for the PR, makes sense to me. However, would it be better to add the default type to the Button component itself?

It is up to you, but I think it is better if we let the default as it, everyone already knows that the default button type is "submit", they can change that, the reason I submitted this PR is because I had a dropdown in a form and it kept submitting the form when I was clicking it, unless I add a custom wrapper, there was no other way to set this property.