React-Bootstrap Close Button Variants
Last Updated :
24 Apr, 2025
React-Bootstrap Close Button Variants can defined as the CloseButton component that provides the flexibility to create a close button with a range of variants, enabling you to style the button according to your specific design requirements. Bootstrap's button variants, offer you the means to harmonize the appearance of the close button with the overall aesthetic of your application.
variant property values:
- white: The close button will be in white color
- dark: The close button will be in dark color
Syntax:
<CloseButton variant = "value" />
Example 1: This example creates the close button with dark and white color buttons using variant property.
JavaScript
import { CloseButton }
from 'react-bootstrap';
const App = () => {
return (
<div className="App">
<h1 style={
{ color: 'green', textAlign: 'center' }
}> GeeksforGeeks
</h1>
<h5 style={
{ textAlign: 'center' }
}>React-Bootstrap Close Button Variants
</h5>
<br></br>
<div style={{ textAlign: 'center' }}>
<CloseButton variant="dark" />
<div style={{ backgroundColor: 'black' }}>
<CloseButton variant="white" />
</div>
</div>
</div>
);
};
export default App;