[Button] - FAB icon is not centered on wide screens
See original GitHub issueDescription
The style seems to use wrong height/width values for the FAB (floating button) on wide screens:
.md-btn--floating{height:48px;padding:14px;width:48px}
It seems it should use 56px instead of 48px.
Images/Screenshots
Version
- React 15.6.1
- React-MD 1.1.0-alpha-7
Issue Analytics
- State:
- Created 6 years ago
- Comments:5 (5 by maintainers)
Top Results From Across the Web
Android: Floating Button Icon is not centred - Stack Overflow
Use layout width and height of floatingActionButton as wrap-content. It will solve all the problems . <com.google.android.material.floatingactionbutton.
Read more >FAB icon is not centered when using FontAwesome icons #1479
When I use FAB button it renders + icon not centered ... Set FontAwesome as a default icons source, use FAB with "plus"...
Read more >5 Daily issues Android-Floating Action Button Icon not aligned ...
When I am trying to set the height and width value instead of wrap_content to FAB, the FAB icon not aligned to centre....
Read more >Buttons: floating action button - Material Design
A floating action button (FAB) represents the primary action of a screen. ... all screen content, typically as a circular shape with an...
Read more >Quick Tips to Start Using ExtendedFloatingActionButton
Find the right placement. Advice from material.io: “The extended FAB can be positioned in the center, left, or right side of a screen.”...
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 Free
Top 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
I could update the styles to something like this:
which would work for these cases. It would just be harder to manually update the size of icons anywhere else. Maybe this isn’t too bad since there is the
forceSize
prop on theFontIcon
? I’ll either update the documentation to tell the import order, or add this. I’ll close once I decide or if anyone else has opinionsOK, I figured the root cause: I include
material-icons-fontface.css
AFTER the React-MD style sheets, and.material-icons
class overrides thefont-size
. If I swap the<link>
tags so Material icons style sheets are included BEFORE the React-MD ones, the issue goes away.React-MD 1.0.x doesn’t change the size of the FAB button based on the screen size, which is why it works fine there.
I am not sure I like the idea of importing fonts before React-MD styles, but I can live with it. Feel free to close the issue if there is nothing you can do about it.