HyperPlay-Gaming / hyperplay-ui

HyperPlay UI kit package
https://hyperplay-ui.vercel.app
GNU Lesser General Public License v3.0
1 stars 0 forks source link

Use variant instead of type as prop name for the Button component #69

Open eliobricenov opened 1 year ago

eliobricenov commented 1 year ago

Currently, we're using type to define the variant of the button from the design system, this conflicts with the HTML Button type prop.

For example, submitting a form with a button, is not currently possible:

<form>
 <input />
 <Button type="submit" />
</form>

We should use variant instead:

<form>
 <input />
 <Button variant="primary" size="large" type="submit" />
</form>

EDIT: Mantine, ChakraUI and MaterialUI use variant

eliobricenov commented 1 year ago

Not my fav API but decided to add htmlType?: ButtonHTMLAttributes<HTMLButtonElement>['type'] to the button props, this change would be complicated to make, the button component is used a lot.

BrettCleary commented 12 months ago

Not my fav API but decided to add htmlType?: ButtonHTMLAttributes<HTMLButtonElement>['type'] to the button props, this change would be complicated to make, the button component is used a lot.

Then I think we should reopen this issue and reframe it as a refactor from type to variant and from htmlType to type. we'll have to open PR's on the store, website, and desktop client but it should just be a simple find and replace

I'll tag it as a low priority sustainability issue