diff --git a/src/core/primitives/button/button.tsx b/src/core/primitives/button/button.tsx index cec4176cc..2ba4a4499 100644 --- a/src/core/primitives/button/button.tsx +++ b/src/core/primitives/button/button.tsx @@ -1,4 +1,4 @@ -import {createElement, forwardRef, isValidElement, useMemo} from 'react' +import {forwardRef, isValidElement, useMemo} from 'react' import {isValidElementType} from 'react-is' import {styled} from 'styled-components' import {useArrayProp} from '../../hooks' @@ -68,8 +68,8 @@ export const Button = forwardRef(function Button( children, disabled, fontSize = 1, - icon, - iconRight, + icon: IconComponent, + iconRight: IconRightComponent, justify: justifyProp = 'center', loading, mode = 'default', @@ -138,13 +138,13 @@ export const Button = forwardRef(function Button( )} - {(icon || text || iconRight) && ( + {(IconComponent || text || IconRightComponent) && ( - {icon && ( + {IconComponent && ( - {isValidElement(icon) && icon} - {isValidElementType(icon) && createElement(icon)} + {isValidElement(IconComponent) && IconComponent} + {isValidElementType(IconComponent) && } )} @@ -160,10 +160,10 @@ export const Button = forwardRef(function Button( )} - {iconRight && ( + {IconRightComponent && ( - {isValidElement(iconRight) && iconRight} - {isValidElementType(iconRight) && createElement(iconRight)} + {isValidElement(IconRightComponent) && IconRightComponent} + {isValidElementType(IconRightComponent) && } )}