Search code examples
cssreactjsantd

giving border radius to ant-design card in react


so, I am having ant-design card that needs a border radius, but if I add Inline CSS, it still not working, I also tried

And here is the follow code:

<Card style = {{width: 300, margin: "20px", borderRadius: "20px"}} actions = {[<h4 style = {{ paddingTop: "6px"}} key="Name">Table Name </h4>,]}></Card>

Is there any way I can control the border radius of this card?


Solution

  • Adding overflow:hidden with borderRadius to the card style will fix the issue of the actions container's corners not being round.

    <Card
      style={{
        width: 300,
        margin: "20px",
        borderRadius: "20px",
        overflow: "hidden"
      }}
      actions={[
        <h4 style={{ paddingTop: "6px" }} key="Name">
          Table Name{" "}
        </h4>
      ]}
    >
      <p>Card content</p>
      <p>Card content</p>
      <p>Card content</p>
    </Card>
    

    Edit antd reproduction template (forked)