question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Icon passed into rounded button distorts the button by adding extra space beneath icon

See original GitHub issue

Expected Behavior

When trying to create a round button, I expect that the icon would be spaced in the center of the button. screen shot 2019-02-05 at 2 18 31 pm

Actual Behavior

The button becomes oblong and the icon has space beneath it. screen shot 2019-02-05 at 2 18 16 pm screen shot 2019-02-05 at 2 18 24 pm

URL, screen shot, or Codepen exhibiting the issue

https://codesandbox.io/s/30ol4r18vp

Steps to Reproduce

Create a button inside of a round box with an icon:

<Box round="full" background="light-3">
  <Button icon={<Add />} onClick={() => ""} />
</Box>

Your Environment

  • Grommet version: 2.3.1
  • Browser Name and version: Chrome
  • Operating System and version (desktop or mobile): Either

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:6 (6 by maintainers)

github_iconTop GitHub Comments

2reactions
atanasstercommented, Feb 5, 2019

Some PRs ago it seems the icon display css changed to inline-block and that started causing the added spacing at the bottom of icons. It comes in the way in many use cases,

Here is what I am now using:

export default styled(Button)`
  border-radius: 50%;
  &>svg {
    display: block;
  }
`;

https://github.com/atanasster/grommet-controls/blob/master/src/js/components/IconButton/StyledIconButton.js

0reactions
atanasstercommented, Feb 13, 2019

The inline-block is on the svg - I might be wrongly recollecting on the exact way it started hapenning, but i am sure it was working ok up to a certain point and then suddenly all buttons with icons became off-center and i started using my fix.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to center icon and text in a android button with width set ...
This moves my icon straight to the left of the button and I want both icon and text centered inside the button. I've...
Read more >
How to Create Rounded Icon Buttons - HTML & CSS Web ...
View the code:https://codepen.io/dcode-software/pen/VwbMdBXIonicons Library:https://ionic.io/ioniconsIn this video I'll be showing you how ...
Read more >
Enhancing The Clickable Area Size - Ahmad Shadeed
This happens because the clickable area is not applied to the whole element. To make it more clear, see the below figure.
Read more >
Make sense of rounded corners on buttons - UX Collective
Rounded corners are more recognizable than sharp corners ... A fully rounded button usually includes a chevron icon to indicate that there ...
Read more >
Floating Action Button (FAB) in Android with Example
Step 1: Create a New Project in Android Studio · Step 2: Adding Dependency to the build.gradle File · Step 3: Add the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found