@@ -6,7 +6,7 @@ import { useUncontrolled } from 'uncontrollable';
66import useEventCallback from '@restart/hooks/useEventCallback' ;
77import { useBootstrapPrefix } from './ThemeProvider' ;
88import Fade from './Fade' ;
9- import CloseButton from './CloseButton' ;
9+ import CloseButton , { CloseButtonVariant } from './CloseButton' ;
1010import { Variant } from './types' ;
1111import divWithClassName from './divWithClassName' ;
1212import createWithBsPrefix from './createWithBsPrefix' ;
@@ -20,6 +20,7 @@ export interface AlertProps extends React.HTMLProps<HTMLDivElement> {
2020 show ?: boolean ;
2121 onClose ?: ( a : any , b : any ) => void ;
2222 closeLabel ?: string ;
23+ closeVariant ?: CloseButtonVariant ;
2324 transition ?: TransitionType ;
2425}
2526
@@ -77,6 +78,11 @@ const propTypes = {
7778 */
7879 closeLabel : PropTypes . string ,
7980
81+ /**
82+ * Sets the variant for close button.
83+ */
84+ closeVariant : PropTypes . oneOf < CloseButtonVariant > ( [ 'white' ] ) ,
85+
8086 /**
8187 * Animate the alert dismissal. Defaults to using `<Fade>` animation or use
8288 * `false` to disable. A custom `react-transition-group` Transition can also
@@ -97,6 +103,7 @@ const Alert = (React.forwardRef<HTMLDivElement, AlertProps>(
97103 bsPrefix,
98104 show,
99105 closeLabel,
106+ closeVariant,
100107 className,
101108 children,
102109 variant,
@@ -128,7 +135,11 @@ const Alert = (React.forwardRef<HTMLDivElement, AlertProps>(
128135 ) }
129136 >
130137 { dismissible && (
131- < CloseButton onClick = { handleClose } label = { closeLabel } />
138+ < CloseButton
139+ onClick = { handleClose }
140+ aria-label = { closeLabel }
141+ variant = { closeVariant }
142+ />
132143 ) }
133144 { children }
134145 </ div >
0 commit comments