Close Button
A generic close button for dismissing content such as modals and alerts.
Example
Disabled state
Bootstrap adds relevant styling to a disabled close button to prevent user interactions.
Variants
Change the default dark color to white using variant="white"
.
Accessibility
To ensure the maximum accessibility for Close Button components, it is
recommended that you provide relevant text for screen readers. The example
below provides an example of accessible usage of this component by way of the
aria-label
property.
API
CloseButtonview source file
import CloseButton from 'react-bootstrap/CloseButton'
Copy import code for the CloseButton componentName | Type | Default | Description |
---|---|---|---|
aria-label | string | 'Close' | An accessible label indicating the relevant information about the Close Button. |
onClick | function | A callback fired after the Close Button is clicked. | |
variant | 'white' | Render different color variant for the button. Omitting this will render the default dark color. |