ant-design add extraStyle property in Card component

l2osamch  于 2022-10-23  发布在  其他
关注(0)|答案(5)|浏览(226)
  • I have searched the issues of this repository and believe that this is not a duplicate.

What problem does this feature solve?

it's would be nice to have extraStyle property in Card component (to edit padding...) and not only a size property

What does the proposed API look like?

<Card
...
extra="content"
extraStyle={{ padding:0 }}
>
zaq34kh6

zaq34kh61#

<Card
  ...
  extra={<div style={{ padding:0 }}>content</div>}
  ...
/>
2nc8po8w

2nc8po8w2#

<Card
  ...
  extra={<div style={{ padding:0 }}>content</div>}
  ...
/>

It's giving that :

svujldwt

svujldwt3#

He wants to control the ant-card-extra . For example, it is align to right, it's by design. If custom really necessary, overwriting it.

xvw2m8pv

xvw2m8pv4#

Any news on this issue? Really need this change

6vl6ewon

6vl6ewon5#

For anyone searching for a solution until this feature exists, you can hack it with custom css.
E.g. you can give your Card a custom class name:

<Card
    className='card-extra-no-padding'
    extra={<span>I won't have any padding!</span>}
/>

Then in some imported css file use:

.ant-card.card-extra-no-padding .ant-card-extra {
  padding: 0;
}

相关问题