mirror of
https://github.com/grafana/grafana.git
synced 2025-07-29 17:12:29 +08:00
Grafana UI: Fix tooltip prop of button component (#64765)
fix tooltip prop of Button component
This commit is contained in:

committed by
GitHub

parent
a6b2bc3997
commit
1c7921770c
@ -44,6 +44,8 @@ export const Button = React.forwardRef<HTMLButtonElement, ButtonProps>(
|
||||
children,
|
||||
className,
|
||||
type = 'button',
|
||||
tooltip,
|
||||
tooltipPlacement,
|
||||
...otherProps
|
||||
},
|
||||
ref
|
||||
@ -58,12 +60,22 @@ export const Button = React.forwardRef<HTMLButtonElement, ButtonProps>(
|
||||
iconOnly: !children,
|
||||
});
|
||||
|
||||
return (
|
||||
const button = (
|
||||
<button className={cx(styles.button, className)} type={type} {...otherProps} ref={ref}>
|
||||
{icon && <Icon name={icon} size={size} className={styles.icon} />}
|
||||
{children && <span className={styles.content}>{children}</span>}
|
||||
</button>
|
||||
);
|
||||
|
||||
if (tooltip) {
|
||||
return (
|
||||
<Tooltip content={tooltip} placement={tooltipPlacement}>
|
||||
{button}
|
||||
</Tooltip>
|
||||
);
|
||||
}
|
||||
|
||||
return button;
|
||||
}
|
||||
);
|
||||
|
||||
|
Reference in New Issue
Block a user