From f39633b190da5b7e453d958bf36028c8332139f5 Mon Sep 17 00:00:00 2001 From: Tal Koren Date: Thu, 12 Dec 2024 12:04:37 +0200 Subject: [PATCH] feat(Tooltip): be able to change max width (#2643) --- packages/core/src/components/Tooltip/Tooltip.tsx | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/packages/core/src/components/Tooltip/Tooltip.tsx b/packages/core/src/components/Tooltip/Tooltip.tsx index d94424bd7a..4d08230882 100644 --- a/packages/core/src/components/Tooltip/Tooltip.tsx +++ b/packages/core/src/components/Tooltip/Tooltip.tsx @@ -128,6 +128,10 @@ interface TooltipBaseProps extends VibeComponentProps { * The icon of the tooltip next to the title */ icon?: SubIcon; + /** + * Sets the max width of the Tooltip, defaults to 240px + */ + maxWidth?: number; } // When last tooltip was shown in the last 1.5 second - the next tooltip will be shown immediately const IMMEDIATE_SHOW_THRESHOLD_MS = 1500; @@ -174,7 +178,7 @@ export default class Tooltip extends PureComponent { } renderTooltipContent() { - const { theme, content, className, style, title, image, icon } = this.props; + const { theme, content, className, style, maxWidth, title, image, icon } = this.props; if (!content) { // don't render empty tooltip return null; @@ -196,7 +200,10 @@ export default class Tooltip extends PureComponent { } return ( -
+
{image && }
{title && (