svelteuidev / svelteui

SvelteUI Monorepo
https://svelteui.dev
MIT License
1.28k stars 64 forks source link

[Feature Request] Add `type` parameter for `<Button>` #371

Closed notramo closed 1 year ago

notramo commented 1 year ago

Usage example, including component, action, motion, or utility API

<Button type="submit">Submit</Button>

Possible implementation - describe how the feature can be implemented

No response

Do you want to contribute this feature and create a pull request

Yes

BeeMargarida commented 1 year ago

Hey, this should already be possible, since all parameters of the DOM <button> are supported and passed to the component below. Is this not working for you?

notramo commented 1 year ago

It works with JavaScript, but with TypeScript it throws an error.

BeeMargarida commented 1 year ago

A wild bug has appeared ❗ 🐛 I'll investigate this, thank you for reporting it!

notramo commented 1 year ago

It appears with other elements, e.g. <TextInput type="password" name="user:password"/> also results in TS error, for both type and name. (At least TextInput has a workaround with wrapperProps, but it's not documented.)

BeeMargarida commented 1 year ago

Are you using the latest version 0.11.1?

notramo commented 1 year ago

No, somehow I missed the updates. It seems that the ^ operator in package.json doesn't take into account versions below 1.0.

It seems to be fixed in the latest version.

BeeMargarida commented 1 year ago

Nice!