Skip to content

Commit

Permalink
feat(Tooltip): add dir prop
Browse files Browse the repository at this point in the history
  • Loading branch information
rivka-ungar committed Dec 18, 2024
1 parent 2c8a294 commit 2a6998b
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion packages/core/src/components/Tooltip/Tooltip.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,10 @@ interface TooltipBaseProps extends VibeComponentProps {
* Sets the max width of the Tooltip, defaults to 240px
*/
maxWidth?: number;
/**
* Sets the text direction of the tooltip: "ltr", "rtl", or "auto"
*/
dir?: "ltr" | "rtl" | "auto";
}
// When last tooltip was shown in the last 1.5 second - the next tooltip will be shown immediately
const IMMEDIATE_SHOW_THRESHOLD_MS = 1500;
Expand Down Expand Up @@ -178,7 +182,7 @@ export default class Tooltip extends PureComponent<TooltipProps> {
}

renderTooltipContent() {
const { theme, content, className, style, maxWidth, title, image, icon } = this.props;
const { theme, content, className, style, maxWidth, title, image, icon, dir } = this.props;
if (!content) {
// don't render empty tooltip
return null;
Expand All @@ -203,6 +207,7 @@ export default class Tooltip extends PureComponent<TooltipProps> {
<div
style={maxWidth ? ({ ...style, "--tooltip-max-width": `${maxWidth}px` } as CSSProperties) : style}
className={cx(styles.tooltip, getStyle(styles, camelCase(theme)), className)}
dir={dir}
>
{image && <img className={styles.image} src={image} alt="" />}
<div className={cx(styles.content)}>
Expand Down

0 comments on commit 2a6998b

Please sign in to comment.