An Icon only button doesn't have a border
See original GitHub issueExpected Behavior
The <Button>
component should have a border if an the icon
property is used and the label
and children
are not present. I would expect the border to be gone only if I have used the plain
property.
Actual Behavior
If only the icon
property is used, the button will have no border, and the border radius from the theme is not applied. The exception to this is if you use the primary
prop as well, which will cause the button to render as expected.
URL, screen shot, or Codepen exhibiting the issue
In the following codepen you can see the various states of an icon-only button. I’ve added a border style to highlight the lack of border radius in the styled component.
https://codesandbox.io/s/x3oz9jp18p
Steps to Reproduce
import React from "react";
import ReactDOM from "react-dom";
import { Grommet, Button } from "grommet";
import { Facebook } from "grommet-icons";
function App() {
return (
<Grommet>
<Button icon={<Facebook />} />
</Grommet>
);
}
const rootElement = document.getElementById("root");
ReactDOM.render(<App />, rootElement);
Your Environment
- Grommet version: v2.6.6
- Browser Name and version: https://www.whatsmybrowser.org/
- Operating System and version (desktop or mobile): OS X 10.13.6
Issue Analytics
- State:
- Created 4 years ago
- Comments:5 (5 by maintainers)
Top Results From Across the Web
Lightning button icon without border
As sfdcfox already said That border is there to indicate active focus..... but if you still want to remove it assign a class...
Read more >How to have a css outline on a <button> tag, only by tab, but ...
This is the only way to ensure that the Buttons will always have an outline 'just during focusing on while tabbing' for accessibility,...
Read more >The Button element - HTML: HyperText Markup Language
Buttons that only show an icon to represent do not have an accessible ... This border is declared through CSS in the browser...
Read more >lightning-button-icon - documentation - Salesforce Developers
A lightning-button-icon component represents an icon-only button element that executes an action in ... bare displays an icon without a container or border...
Read more >Button - Grommet
Only relevant for themes that have defined a value for button.default. object. { background: string | object, border: ...
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
Thanks for the clarification @dallas
TLDR: Setting plain to
false
explicitly will give an icon-only button padding and a borderAnd here’s a forked version of your Code Sandbox showing the 3 different states as well.