ant design: modify border-radius for Input component
Asked Answered
D

1

8

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?

Dolph answered 4/8, 2019 at 3:4 Comment(1)
Hi , I am stuck with the same problem, Any Idea on how to do this for the Input text field?Miru
I
13

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;
  }
}

Edit Q-57343486-StyleInputSearch

Intermeddle answered 4/8, 2019 at 8:58 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.