Icon passed into rounded button distorts the button by adding extra space beneath icon
See original GitHub issueExpected Behavior
When trying to create a round button, I expect that the icon would be spaced in the center of the button.
Actual Behavior
The button becomes oblong and the icon has space beneath it.
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:
- Created 5 years ago
- Comments:6 (6 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
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:
https://github.com/atanasster/grommet-controls/blob/master/src/js/components/IconButton/StyledIconButton.js
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.