import { forwardRef } from 'react'; import { PolymorphicRef } from '../../utils/Polymorphic'; import { ButtonProps } from './Button.type'; import { useButton } from './useButton'; import { StyledButton } from './Button.style'; import { Spinner } from '..'; export const Button = forwardRef( ( props: ButtonProps, ref: PolymorphicRef['ref'] ): React.ReactNode => { const { domRef, as, children, styledProps, buttonProps, isLoading, spinnerSize, prefix, suffix, } = useButton({ ...props, ref, }); return ( {isLoading ? ( ) : ( prefix && {prefix} )} {children} {suffix && {suffix}} ); } ); Button.displayName = 'Button';