mirror of
https://github.com/invoke-ai/InvokeAI
synced 2024-08-30 20:32:17 +00:00
29 lines
686 B
TypeScript
29 lines
686 B
TypeScript
import {
|
|
Button,
|
|
ButtonProps,
|
|
forwardRef,
|
|
Tooltip,
|
|
TooltipProps,
|
|
} from '@chakra-ui/react';
|
|
import { memo, ReactNode } from 'react';
|
|
|
|
export interface IAIButtonProps extends ButtonProps {
|
|
tooltip?: string;
|
|
tooltipProps?: Omit<TooltipProps, 'children'>;
|
|
isChecked?: boolean;
|
|
children: ReactNode;
|
|
}
|
|
|
|
const IAIButton = forwardRef((props: IAIButtonProps, forwardedRef) => {
|
|
const { children, tooltip = '', tooltipProps, isChecked, ...rest } = props;
|
|
return (
|
|
<Tooltip label={tooltip} {...tooltipProps}>
|
|
<Button ref={forwardedRef} aria-checked={isChecked} {...rest}>
|
|
{children}
|
|
</Button>
|
|
</Tooltip>
|
|
);
|
|
});
|
|
|
|
export default memo(IAIButton);
|