Solution
To change ant design button background color in react js, first install ant design library using npm install antd
command import and use button
component from it. We have used style attribute
to change the background color in it.
Snippet
In this snippet, see the short example to use button
component of ant design library, with the use css style style={{backgroundColor: 'pink'}}
.
<div>
<Button style={{backgroundColor: 'pink'}}>BackgroundColor</Button>
</div>
Example
In this example, we will import the button
component from the ant library, and use the <div>
element with CSS style style={{backgroundColor: 'pink'}}
. it will change the background color on the button.
Let’s start coding…
App.js
import { Button } from 'antd';
function App() {
return (
<div>
<Button style={{backgroundColor: 'pink'}}>BackgroundColor</Button>
</div>
);
}
export default App;
Output
Links
Here, we are provided code sandbox links for the above program change ant design button background color. Then you can use whenever you went and do the changes as per your requirements.
Happy Coding,
I hope the above example with help you to do your task.