Deckard85
Deckard85

Reputation: 51

text and icon in a antd button are not aligned vertically

my issue is that my text and icon in a antd button are not aligned vertically in my react app.

Here is the code:

             <Button type="primary" size="large" block icon={<PlusCircleOutlined />} onClick={()=>this.showModalSharePicture()}>
          Text
          </Button>

The icon is is little bit low compare to the text witch is well centered in the button. How can solve this issue that I have in all my buttons?

Here is the rendered html:

<button type="button" class="ant-btn ant-btn-primary ant-btn-lg ant-btn-block"><span role="img" aria-label="plus-circle" class="anticon anticon-plus-circle"><svg viewBox="64 64 896 896" focusable="false" data-icon="plus-circle" width="1em" height="1em" fill="currentColor" aria-hidden="true"><path d="M696 480H544V328c0-4.4-3.6-8-8-8h-48c-4.4 0-8 3.6-8 8v152H328c-4.4 0-8 3.6-8 8v48c0 4.4 3.6 8 8 8h152v152c0 4.4 3.6 8 8 8h48c4.4 0 8-3.6 8-8V544h152c4.4 0 8-3.6 8-8v-48c0-4.4-3.6-8-8-8z"></path><path d="M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm0 820c-205.4 0-372-166.6-372-372s166.6-372 372-372 372 166.6 372 372-166.6 372-372 372z"></path></svg></span><span>Text</span></button>

Upvotes: 3

Views: 10738

Answers (1)

Konstantinos Gallis
Konstantinos Gallis

Reputation: 1140

One possible way to do it is by using the following style:

button,
span {
  display: inline-flex;
  align-items: center;
}

You can also use their class names ant-btn, anticon to style them regards your preferences and needs.

Upvotes: 5

Related Questions