I have the following ant design search input component:
 <Search
  size="large"
  placeholder="Search..."
  className="dashboardSearch"
  />
I am trying to modify the border radius to give it a circular shape but everything i try in my css file doesnt work.
css file:
.dashboardSearch {
    width: 300px;
    border-radius: 25px;
}
.ant-input-search {
    width: 300px;
    border-radius: 25px;
}
is there anyway to modify the border radius of the search input component? usually when I modify the ant design class name directly it works. but in this case it doesn't. Is there another way that I am missing?
If you import styles by specifying the style option of babel-plugin-import, change it from 'css' to true , which will import the less version of antd. If you import styles from 'antd/dist/antd. css' , change it to antd/dist/antd.
From the stack to the horizontal arrangement. You can create a basic grid system by using a single set of Row and Col grid assembly, all of the columns (Col) must be placed in Row . You can use the gutter property of Row as grid spacing, we recommend set it to (16 + 8n) px ( n stands for natural number).
You need to target .antd-input class inside the Input.Search.
For example with CSS-in-JS:
const RoundSearch = styled(Input.Search)`
  .ant-input {
    border-radius: 25px;
  }
`;
export default function App() {
  return (
    <FlexBox>
      <RoundSearch />
    </FlexBox>
  );
}
Or in your case:
.dashboardSearch {
  .ant-input {
    border-radius: 25px;
  }
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With