-
+
+ {renderCustomIcon ? callRenderProp(renderCustomIcon) : }
)
}
diff --git a/packages/ui-alerts/src/Alert/props.ts b/packages/ui-alerts/src/Alert/props.ts
index bfa9d3b3ec..2c3b759671 100644
--- a/packages/ui-alerts/src/Alert/props.ts
+++ b/packages/ui-alerts/src/Alert/props.ts
@@ -109,6 +109,11 @@ type AlertOwnProps = {
* If the alert should have a shadow.
*/
hasShadow: boolean
+
+ /**
+ * An icon, or function that returns an icon. Setting it will override the variant's icon.
+ */
+ renderCustomIcon?: Renderable
}
type PropKeys = keyof AlertOwnProps
@@ -137,7 +142,8 @@ const propTypes: PropValidators
= {
transition: PropTypes.oneOf(['none', 'fade']),
open: PropTypes.bool,
hasShadow: PropTypes.bool,
- variantScreenReaderLabel: PropTypes.string
+ variantScreenReaderLabel: PropTypes.string,
+ renderCustomIcon: PropTypes.oneOfType([PropTypes.node, PropTypes.func])
}
const allowedProps: AllowedPropKeys = [
@@ -153,7 +159,8 @@ const allowedProps: AllowedPropKeys = [
'onDismiss',
'transition',
'open',
- 'hasShadow'
+ 'hasShadow',
+ 'renderCustomIcon'
]
type AlertState = {
diff --git a/packages/ui-alerts/src/Alert/styles.ts b/packages/ui-alerts/src/Alert/styles.ts
index cdf49b0ea2..38a264fdb5 100644
--- a/packages/ui-alerts/src/Alert/styles.ts
+++ b/packages/ui-alerts/src/Alert/styles.ts
@@ -95,6 +95,9 @@ const generateStyle = (
justifyContent: 'center',
fontSize: '1.125rem',
borderRight: `${componentTheme.borderWidth} ${componentTheme.borderStyle}`,
+ margin: -1,
+ borderStartStartRadius: componentTheme.borderRadius,
+ borderEndStartRadius: componentTheme.borderRadius,
...variantStyles[variant!].icon
},
closeButton: {