Skip to content

The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.

feat(ui): add multiline support to tooltip component

Steven Enamakel4a90f2036f39
diff --git a/app/src/components/ui/BetaIndicator.tsx b/app/src/components/ui/BetaIndicator.tsx
index 7c31616e6c..c5bde84a87 100644
--- a/app/src/components/ui/BetaIndicator.tsx
+++ b/app/src/components/ui/BetaIndicator.tsx
@@ -18,7 +18,7 @@ export default function BetaIndicator({ message, side = 'bottom', className }: B
const label = message ?? t('common.betaDisclaimer');
return (
- <Tooltip label={label} side={side}>
+ <Tooltip label={label} side={side} multiline>
<Button
type="button"
iconOnly
diff --git a/app/src/components/ui/Tooltip.tsx b/app/src/components/ui/Tooltip.tsx
index e3dea10ef3..8b4a24b1eb 100644
--- a/app/src/components/ui/Tooltip.tsx
+++ b/app/src/components/ui/Tooltip.tsx
@@ -26,6 +26,8 @@ interface TooltipProps {
side?: TooltipSide;
/** Hover/focus dwell before showing, in ms. Keeps the tip from flickering. */
delayMs?: number;
+ /** Allow explanatory copy to wrap instead of using the compact one-line pill. */
+ multiline?: boolean;
}
/** Gap in px between the trigger and the tooltip pill. */
@@ -76,7 +78,13 @@ const TRANSFORM: Record<TooltipSide, string> = {
* screen readers (it takes precedence over `title`, so there's no double
* announcement); the pill itself is decorative (`aria-hidden`).
*/
-export default function Tooltip({ label, children, side = 'right', delayMs = 300 }: TooltipProps) {
+export default function Tooltip({
+ label,
+ children,
+ side = 'right',
+ delayMs = 300,
+ multiline = false,
+}: TooltipProps) {
const [anchor, setAnchor] = useState<Anchor | null>(null);
const timerRef = useRef<ReturnType<typeof setTimeout> | null>(null);
@@ -153,7 +161,9 @@ export default function Tooltip({ label, children, side = 'right', delayMs = 300
// Semantic tokens, not `bg-stone-800`/`text-white`/`dark:bg-neutral-700`:
// those are raw palette scales, so the pill kept a fixed grey under
// every user theme instead of following it.
- className="pointer-events-none fixed z-[9999] whitespace-nowrap rounded-md bg-content px-2 py-1 text-xs font-medium text-surface shadow-medium animate-fade-in"
+ className={`pointer-events-none fixed z-[9999] rounded-md bg-content px-2 py-1 text-xs font-medium text-surface shadow-medium animate-fade-in ${
+ multiline ? 'max-w-xs whitespace-normal' : 'whitespace-nowrap'
+ }`}
style={{ top: anchor.top, left: anchor.left, transform: TRANSFORM[anchor.side] }}>
{label}
</div>,