nextui-org / nextui

🚀 Beautiful, fast and modern React UI library.
https://nextui.org
MIT License
21.21k stars 1.35k forks source link

[QUESTION] - Overriding default Input & Button style #347

Closed cliffordfajardo closed 2 years ago

cliffordfajardo commented 2 years ago

Describe the bug

Passing a style object to <Input> to remove the rounded border does not work. As a user sometimes, would like a rectangular input box

<Input
  value="test"
  placeholder="Search..."
  type="search"
  clearable
  size="lg"
  width="100%"
  style={{
    borderRadius: "initial !important", //❌
  }}
/>;

Allow user to to remove border-radius from inputs and buttons i

Steps to Reproduce the Bug or Issue

  1. Pass border-radius: initial !important to the input component & see that it does not remove the border radius

CleanShot 2022-03-20 at 07 27 53

CleanShot 2022-03-20 at 07 28 55

Expected behavior

Passing border-radius: initial !important shouls remove the rounded border

Screenshots or Videos

No response

Operating System Version

MacOS

Browser

Chrome

cliffordfajardo commented 2 years ago

I think we we might need to think about an overrides API. I've seen this used in other libraries like:

Dhananjay-JSR commented 2 years ago

Hello @cliffordfajardo , NextUI Does Provide different ways to Override Default Styles of Component and ways to create your own component , More Details about which can be found on Official Documentation Page

And coming back to your point to Remove Rounded Corners from Input and Button , the code should be

<Button css={{borderRadius: "0"}}>Default</Button>

<Input css={{ $$inputBorderRadius: "0" }} bordered/>

cliffordfajardo commented 2 years ago

@Dhananjay-JSR - ahh thank you!

I was curious about style vs css prop & overlooked it in the docs

NextUI provides the Stitches css prop for overriding styles easily. It's like the style attribute, but it supports tokens, media queries, nesting and token-aware values.

This resolved my issue, so going to close this 🙏