Skip to content

The fastest, litest AI Gateway. Rust core with Python SDK. Call 100+ LLM APIs in OpenAI (or native) format with cost tracking, guardrails, load balancing, and logging [Bedrock, Azure, OpenAI, Anthropic, OpenAI, VertexAI, vLLM, Nvidia NIM]

refactor(ui): codemod the antd Tooltips outside form files onto the shadcn atom (#37402)

ryan-crabbe-berriec6f1c1a5634
diff --git a/ui/litellm-dashboard/src/app/(dashboard)/guardrails/_components/guardrail_info.test.tsx b/ui/litellm-dashboard/src/app/(dashboard)/guardrails/_components/guardrail_info.test.tsx
index 320e0b5baef..b6ee130d50a 100644
--- a/ui/litellm-dashboard/src/app/(dashboard)/guardrails/_components/guardrail_info.test.tsx
+++ b/ui/litellm-dashboard/src/app/(dashboard)/guardrails/_components/guardrail_info.test.tsx
@@ -1,5 +1,6 @@
import * as networking from "@/components/networking";
import { fireEvent, render, waitFor, within } from "@testing-library/react";
+import userEvent from "@testing-library/user-event";
import { afterEach, describe, expect, it, vi } from "vitest";
import GuardrailInfoView from "./guardrail_info";
@@ -136,7 +137,7 @@ describe("Guardrail Info", () => {
vi.mocked(networking.getGuardrailProviderSpecificParams).mockResolvedValue({});
- const { getByText, container } = render(
+ const { getByText, findByText, container } = render(
<GuardrailInfoView guardrailId="123" onClose={() => {}} accessToken="123" isAdmin={true} />,
);
@@ -152,18 +153,9 @@ describe("Guardrail Info", () => {
expect(getByText("Guardrail Settings")).toBeInTheDocument();
});
- // Find the info icon and hover over it
- const infoIcon = within(container).getByRole("img", { name: "info-circle" });
- expect(infoIcon).toBeInTheDocument();
+ await userEvent.hover(within(container).getByRole("img", { name: "info-circle" }));
- if (infoIcon) {
- fireEvent.mouseEnter(infoIcon);
-
- // Wait for the tooltip to appear
- await waitFor(() => {
- expect(getByText("Guardrail is defined in the config file and cannot be edited.")).toBeInTheDocument();
- });
- }
+ expect(await findByText("Guardrail is defined in the config file and cannot be edited.")).toBeInTheDocument();
});
it("should render the guardrail info", async () => {
diff --git a/ui/litellm-dashboard/src/app/(dashboard)/guardrails/_components/guardrail_info.tsx b/ui/litellm-dashboard/src/app/(dashboard)/guardrails/_components/guardrail_info.tsx
index caac09a1c83..e80ddac932f 100644
--- a/ui/litellm-dashboard/src/app/(dashboard)/guardrails/_components/guardrail_info.tsx
+++ b/ui/litellm-dashboard/src/app/(dashboard)/guardrails/_components/guardrail_info.tsx
@@ -6,7 +6,8 @@ import {
} from "@/components/networking";
import { copyToClipboard as utilCopyToClipboard } from "@/utils/dataUtils";
import { CodeOutlined, EyeInvisibleOutlined, InfoCircleOutlined, StopOutlined } from "@ant-design/icons";
-import { Button as AntdButton, Tooltip } from "antd";
+
+import { Button as AntdButton } from "antd";
import { ArrowLeft, CheckIcon, CopyIcon } from "lucide-react";
import { Badge } from "@/components/ui/badge";
import { Card } from "@/components/ui/card";
@@ -21,7 +22,7 @@ import { Input } from "@/components/ui/input";
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "@/components/ui/select";
import { Separator } from "@/components/ui/separator";
import { Textarea } from "@/components/ui/textarea";
-import { TooltipProvider } from "@/components/ui/tooltip";
+import { SimpleTooltip, TooltipProvider } from "@/components/ui/tooltip";
import {
asText,
GuardrailField,
@@ -663,9 +664,9 @@ const GuardrailInfoView: React.FC<GuardrailInfoProps> = ({ guardrailId, onClose,
<div className="flex justify-between items-center mb-4">
<h3 className="text-lg font-medium">Guardrail Settings</h3>
{isConfigGuardrail && (
- <Tooltip title="Guardrail is defined in the config file and cannot be edited.">
+ <SimpleTooltip content="Guardrail is defined in the config file and cannot be edited.">
<InfoCircleOutlined />
- </Tooltip>
+ </SimpleTooltip>
)}
{!isEditing &&
!isConfigGuardrail &&
diff --git a/ui/litellm-dashboard/src/app/(dashboard)/tag-management/_components/tag_info.tsx b/ui/litellm-dashboard/src/app/(dashboard)/tag-management/_components/tag_info.tsx
index 6db19c6d090..5c561f38197 100644
--- a/ui/litellm-dashboard/src/app/(dashboard)/tag-management/_components/tag_info.tsx
+++ b/ui/litellm-dashboard/src/app/(dashboard)/tag-management/_components/tag_info.tsx
@@ -1,7 +1,8 @@
"use client";
import React, { useState, useEffect } from "react";
-import { Tooltip, Button as AntdButton } from "antd";
+import { SimpleTooltip } from "@/components/ui/tooltip";
+import { Button as AntdButton } from "antd";
import { z } from "zod/v4";
import { fetchUserModels } from "@/components/organisms/create_key_button";
import { getModelDisplayName } from "@/components/key_team_helpers/fetch_available_models_team_key";
@@ -280,7 +281,9 @@ const TagInfoView: React.FC<TagInfoViewProps> = ({ tagId, onClose, accessToken,
) : (
tagDetails.models.map((modelId) => (
<Badge key={modelId} variant="secondary">
- <Tooltip title={`ID: ${modelId}`}>{tagDetails.model_info?.[modelId] || modelId}</Tooltip>
+ <SimpleTooltip content={`ID: ${modelId}`}>
+ {tagDetails.model_info?.[modelId] || modelId}
+ </SimpleTooltip>
</Badge>
))
)}
diff --git a/ui/litellm-dashboard/src/app/(dashboard)/users/_components/view_users/user_info_view.tsx b/ui/litellm-dashboard/src/app/(dashboard)/users/_components/view_users/user_info_view.tsx
index a862e59d793..5ea15df13f0 100644
--- a/ui/litellm-dashboard/src/app/(dashboard)/users/_components/view_users/user_info_view.tsx
+++ b/ui/litellm-dashboard/src/app/(dashboard)/users/_components/view_users/user_info_view.tsx
@@ -17,7 +17,8 @@ import {
teamMemberDeleteCall,
Member,
} from "@/components/networking";
-import { Button as AntdButton, Modal, Tooltip } from "antd";
+import { SimpleTooltip } from "@/components/ui/tooltip";
+import { Button as AntdButton, Modal } from "antd";
import { Field, FieldGroup, FieldLabel } from "@/components/shared/form/field";
import {
Combobox,
@@ -747,10 +748,10 @@ export default function UserInfoView({
<SelectContent>
{MEMBER_ROLE_OPTIONS.map((option) => (
<SelectItem key={option.value} value={option.value} title={option.value}>
- <Tooltip title={option.hint}>
+ <SimpleTooltip content={option.hint}>
<span className="font-medium">{option.value}</span>
<span className="ml-2 text-muted-foreground text-sm">- {option.hint}</span>
- </Tooltip>
+ </SimpleTooltip>
</SelectItem>
))}
</SelectContent>
diff --git a/ui/litellm-dashboard/src/components/Settings/RouterSettings/Fallbacks/FallbackGroupConfig.tsx b/ui/litellm-dashboard/src/components/Settings/RouterSettings/Fallbacks/FallbackGroupConfig.tsx
index 381818a53f5..e3a36f4fbf2 100644
--- a/ui/litellm-dashboard/src/components/Settings/RouterSettings/Fallbacks/FallbackGroupConfig.tsx
+++ b/ui/litellm-dashboard/src/components/Settings/RouterSettings/Fallbacks/FallbackGroupConfig.tsx
@@ -3,7 +3,8 @@
* Handles primary model selection and fallback chain configuration
*/
-import { Select, Tooltip } from "antd";
+import { SimpleTooltip } from "@/components/ui/tooltip";
+import { Select } from "antd";
import { AlertCircle, ArrowDown, X } from "lucide-react";
import React from "react";
@@ -142,12 +143,9 @@ export function FallbackGroupConfig({
}}
maxTagCount="responsive"
maxTagPlaceholder={(omittedValues) => (
- <Tooltip
- styles={{ root: { pointerEvents: "none" } }}
- title={omittedValues.map(({ value }) => value).join(", ")}
- >
+ <SimpleTooltip content={omittedValues.map(({ value }) => value).join(", ")}>
<span>+{omittedValues.length} more</span>
- </Tooltip>
+ </SimpleTooltip>
)}
showSearch
filterOption={(input, option) => (option?.label ?? "").toLowerCase().includes(input.toLowerCase())}
diff --git a/ui/litellm-dashboard/src/components/UsagePage/components/EntityUsage/TopKeyView.tsx b/ui/litellm-dashboard/src/components/UsagePage/components/EntityUsage/TopKeyView.tsx
index 2993f549c65..b3c1be62e88 100644
--- a/ui/litellm-dashboard/src/components/UsagePage/components/EntityUsage/TopKeyView.tsx
+++ b/ui/litellm-dashboard/src/components/UsagePage/components/EntityUsage/TopKeyView.tsx
@@ -3,7 +3,8 @@ import { BarChart } from "@/components/shared/charts";
import { DataTable } from "@/components/shared/DataTable";
import { IdCell, MoneyCell } from "@/components/shared/table_cells";
import { ChevronDownIcon, ChevronUpIcon } from "@heroicons/react/outline";
-import { Segmented, Tooltip } from "antd";
+import { SimpleTooltip } from "@/components/ui/tooltip";
+import { Segmented } from "antd";
import React, { useState } from "react";
import { formatNumberWithCommas } from "../../../../utils/dataUtils";
import { transformKeyInfo } from "../../../key_team_helpers/transform_key_info";
@@ -113,9 +114,9 @@ const TopKeyView: React.FC<TopKeyViewProps> = ({ topKeys, teams, showTags = fals
<div className="overflow-hidden">
<div className="flex flex-wrap items-center gap-1">
{displayTags.map((tag, index) => (
- <Tooltip
+ <SimpleTooltip
key={index}
- title={
+ content={
<div>
<div>
<span className="text-gray-300">Tag Name:</span> {tag.tag}
@@ -128,7 +129,7 @@ const TopKeyView: React.FC<TopKeyViewProps> = ({ topKeys, teams, showTags = fals
}
>
<span className="px-2 py-1 bg-gray-100 rounded-full text-xs">{tag.tag.slice(0, 7)}...</span>
- </Tooltip>
+ </SimpleTooltip>
))}
{hasMoreTags && (
<button
diff --git a/ui/litellm-dashboard/src/components/add_model/ClassificationMethodConfig.tsx b/ui/litellm-dashboard/src/components/add_model/ClassificationMethodConfig.tsx
index 03d8fbc2394..8d42b34a14b 100644
--- a/ui/litellm-dashboard/src/components/add_model/ClassificationMethodConfig.tsx
+++ b/ui/litellm-dashboard/src/components/add_model/ClassificationMethodConfig.tsx
@@ -1,5 +1,6 @@
import { InfoCircleOutlined } from "@ant-design/icons";
-import { Select as AntdSelect, Card, InputNumber, Radio, Space, Switch, Tooltip, Typography } from "antd";
+import { SimpleTooltip } from "@/components/ui/tooltip";
+import { Select as AntdSelect, Card, InputNumber, Radio, Space, Switch, Typography } from "antd";
import React from "react";
import ClassifierPromptEditor from "./ClassifierPromptEditor";
import HeuristicScoringConfig from "./HeuristicScoringConfig";
@@ -286,11 +287,14 @@ const ClassificationMethodConfig: React.FC<ClassificationMethodConfigProps> = ({
<div>
<div className="flex items-center gap-2 mb-1">
<Text strong>Classification Rubric</Text>
- <Tooltip title="Every rubric uses the same four tiers and the same tier definitions. They differ only in the worked examples that show the classifier where the boundary between tiers sits.">
+ <SimpleTooltip content="Every rubric uses the same four tiers and the same tier definitions. They differ only in the worked examples that show the classifier where the boundary between tiers sits.">
<InfoCircleOutlined className="text-gray-400" />
- </Tooltip>
+ </SimpleTooltip>
</div>
- <Tooltip title={usesCustomPrompt ? "Your custom prompt replaces the built-in rubric entirely" : undefined}>
+ <SimpleTooltip
+ content={usesCustomPrompt ? "Your custom prompt replaces the built-in rubric entirely" : undefined}
+ className="w-full"
+ >
<AntdSelect
value={classificationRubric}
onChange={handleClassificationRubricChange}
@@ -302,7 +306,7 @@ const ClassificationMethodConfig: React.FC<ClassificationMethodConfigProps> = ({
label: CLASSIFICATION_RUBRIC_DESCRIPTIONS[preset].label,
}))}
/>
- </Tooltip>
+ </SimpleTooltip>
<Text type="secondary" style={{ display: "block", fontSize: 12 }}>
{usesCustomPrompt
? "Not in use: the custom prompt below is the classifier's entire rubric."
@@ -335,8 +339,8 @@ const ClassificationMethodConfig: React.FC<ClassificationMethodConfigProps> = ({
<Text type="secondary">— right when the classifier grades complexity too</Text>
</Radio>
<Radio value="default_model" disabled={!hasDefaultModel}>
- <Tooltip
- title={
+ <SimpleTooltip
+ content={
hasDefaultModel
? "Change it from the Default Model select."
: "Set a default model on this router to use this option"
@@ -346,7 +350,7 @@ const ClassificationMethodConfig: React.FC<ClassificationMethodConfigProps> = ({
<Text>Route to the default model{defaultModel ? ` (${defaultModel})` : ""}</Text>{" "}
<Text type="secondary">— right when your prompt grades something other than complexity</Text>
</span>
- </Tooltip>
+ </SimpleTooltip>
</Radio>
</Space>
</Radio.Group>
@@ -393,9 +397,9 @@ const ClassificationMethodConfig: React.FC<ClassificationMethodConfigProps> = ({
aria-label="Include Assistant Turns"
/>
<Text strong>Include Assistant Turns</Text>
- <Tooltip title="Off by default. Enabling it changes tier decisions, and therefore spend, for an existing router, and sends assistant text to the classifier model, which may be a different provider than the routed model.">
+ <SimpleTooltip content="Off by default. Enabling it changes tier decisions, and therefore spend, for an existing router, and sends assistant text to the classifier model, which may be a different provider than the routed model.">
<InfoCircleOutlined className="text-gray-400" />
- </Tooltip>
+ </SimpleTooltip>
</div>
<Text type="secondary" style={{ fontSize: 12 }}>
Let the classifier read the assistant&apos;s replies, so difficulty the model stated rather than the user
@@ -411,9 +415,9 @@ const ClassificationMethodConfig: React.FC<ClassificationMethodConfigProps> = ({
<div className="mt-4">
<div className="flex items-center gap-2 mb-1">
<Text strong>Custom Technical Keywords</Text>
- <Tooltip title="Domain-specific terms appended to the built-in technical keyword list. Prompts containing these terms score higher on the technical dimension and route to more capable models.">
+ <SimpleTooltip content="Domain-specific terms appended to the built-in technical keyword list. Prompts containing these terms score higher on the technical dimension and route to more capable models.">
<InfoCircleOutlined className="text-gray-400" />
- </Tooltip>
+ </SimpleTooltip>
</div>
<Text type="secondary" style={{ display: "block", marginBottom: 8, fontSize: 12 }}>
Optional: Add terms to the built-in list to improve classification accuracy on the technical dimension.
diff --git a/ui/litellm-dashboard/src/components/add_model/ComplexityRouterConfig.tsx b/ui/litellm-dashboard/src/components/add_model/ComplexityRouterConfig.tsx
index 3d4845ecf39..9f1108639ac 100644
--- a/ui/litellm-dashboard/src/components/add_model/ComplexityRouterConfig.tsx
+++ b/ui/litellm-dashboard/src/components/add_model/ComplexityRouterConfig.tsx
@@ -1,5 +1,6 @@
import { InfoCircleOutlined } from "@ant-design/icons";
-import { Select as AntdSelect, Card, Collapse, Divider, Input, Space, Switch, Tooltip, Typography } from "antd";
+import { SimpleTooltip } from "@/components/ui/tooltip";
+import { Select as AntdSelect, Card, Collapse, Divider, Input, Space, Switch, Typography } from "antd";
import React from "react";
import { ModelGroup } from "@/components/llm_calls/fetch_models";
import AdaptiveRoutingConfig from "./AdaptiveRoutingConfig";
@@ -249,9 +250,9 @@ const ComplexityRouterConfig: React.FC<ComplexityRouterConfigProps> = ({
<Typography.Title level={4} style={{ margin: 0 }}>
Complexity Tier Configuration
</Typography.Title>
- <Tooltip title="Map each complexity tier to one or more models. Simple queries use cheaper/faster models, complex queries use more capable models.">
+ <SimpleTooltip content="Map each complexity tier to one or more models. Simple queries use cheaper/faster models, complex queries use more capable models.">
<InfoCircleOutlined className="text-gray-400" />
- </Tooltip>
+ </SimpleTooltip>
</Space>
<Text type="secondary" style={{ display: "block", marginBottom: 24 }}>
@@ -279,9 +280,9 @@ const ComplexityRouterConfig: React.FC<ComplexityRouterConfigProps> = ({
<Text strong style={{ fontSize: 16 }}>
{label} Tier
</Text>
- <Tooltip title={tierInfo.description}>
+ <SimpleTooltip content={tierInfo.description}>
<InfoCircleOutlined className="text-gray-400" />
- </Tooltip>
+ </SimpleTooltip>
<Text type="secondary" style={{ fontSize: 12 }}>
Tier {index + 1} of {TIER_KEYS.length} &middot; {tier}
</Text>
@@ -329,9 +330,9 @@ const ComplexityRouterConfig: React.FC<ComplexityRouterConfigProps> = ({
<Text strong style={{ fontSize: 16 }}>
Default Model
</Text>
- <Tooltip title="Leave empty to follow the tiers. A model chosen here is pinned: it stays the default however the tiers change.">
+ <SimpleTooltip content="Leave empty to follow the tiers. A model chosen here is pinned: it stays the default however the tiers change.">
<InfoCircleOutlined className="text-gray-400" />
- </Tooltip>
+ </SimpleTooltip>
</div>
<AntdSelect
value={value.default_model || undefined}
diff --git a/ui/litellm-dashboard/src/components/add_model/EscalationKeywords.tsx b/ui/litellm-dashboard/src/components/add_model/EscalationKeywords.tsx
index c232eb4c801..5d5e2c7b02d 100644
--- a/ui/litellm-dashboard/src/components/add_model/EscalationKeywords.tsx
+++ b/ui/litellm-dashboard/src/components/add_model/EscalationKeywords.tsx
@@ -1,5 +1,6 @@
import { InfoCircleOutlined } from "@ant-design/icons";
-import { Select as AntdSelect, Tooltip, Typography } from "antd";
+import { SimpleTooltip } from "@/components/ui/tooltip";
+import { Select as AntdSelect, Typography } from "antd";
import React from "react";
const { Text } = Typography;
@@ -18,9 +19,9 @@ const EscalationKeywords: React.FC<EscalationKeywordsProps> = ({ keywords, onCha
<Typography.Title level={4} style={{ margin: 0 }}>
Escalation Keywords
</Typography.Title>
- <Tooltip title="Case-sensitive phrases a user can include in their message to force a bump to the next-higher complexity tier when they aren't happy with results. They can force a stronger model, but not choose which one.">
+ <SimpleTooltip content="Case-sensitive phrases a user can include in their message to force a bump to the next-higher complexity tier when they aren't happy with results. They can force a stronger model, but not choose which one.">
<InfoCircleOutlined className="text-gray-400" />
- </Tooltip>
+ </SimpleTooltip>
</div>
<Text type="secondary" style={{ display: "block", marginBottom: 8, fontSize: 12 }}>
Optional: when a user message contains one of these phrases, the request is bumped one tier higher than it would
diff --git a/ui/litellm-dashboard/src/components/add_model/KeywordTierRules.tsx b/ui/litellm-dashboard/src/components/add_model/KeywordTierRules.tsx
index 72d6e9f4fef..49fea3d30e7 100644
--- a/ui/litellm-dashboard/src/components/add_model/KeywordTierRules.tsx
+++ b/ui/litellm-dashboard/src/components/add_model/KeywordTierRules.tsx
@@ -1,5 +1,6 @@
import { DeleteOutlined, InfoCircleOutlined, PlusOutlined } from "@ant-design/icons";
-import { Button, Card, Empty, Select as AntdSelect, Tooltip, Typography } from "antd";
+import { SimpleTooltip } from "@/components/ui/tooltip";
+import { Button, Card, Empty, Select as AntdSelect, Typography } from "antd";
import React from "react";
import { emptyKeywordTierRuleIndexes } from "./complexity_router_keywords";
@@ -70,9 +71,9 @@ const KeywordTierRules: React.FC<KeywordTierRulesProps> = ({ rules, onChange, ti
<Typography.Title level={4} style={{ margin: 0 }}>
Keyword Tier Overrides
</Typography.Title>
- <Tooltip title="Match known terms and force the request straight to a chosen complexity tier, bypassing rule-based scoring.">
+ <SimpleTooltip content="Match known terms and force the request straight to a chosen complexity tier, bypassing rule-based scoring.">
<InfoCircleOutlined className="text-gray-400" />
- </Tooltip>
+ </SimpleTooltip>
</div>
<Button icon={<PlusOutlined />} onClick={addRule}>
Add keyword rule
diff --git a/ui/litellm-dashboard/src/components/add_model/SemanticKeywordMatching.tsx b/ui/litellm-dashboard/src/components/add_model/SemanticKeywordMatching.tsx
index c2252843b29..867f6a901e8 100644
--- a/ui/litellm-dashboard/src/components/add_model/SemanticKeywordMatching.tsx
+++ b/ui/litellm-dashboard/src/components/add_model/SemanticKeywordMatching.tsx
@@ -1,5 +1,6 @@
import { InfoCircleOutlined } from "@ant-design/icons";
-import { InputNumber, Select as AntdSelect, Switch, Tooltip, Typography } from "antd";
+import { SimpleTooltip } from "@/components/ui/tooltip";
+import { InputNumber, Select as AntdSelect, Switch, Typography } from "antd";
import React from "react";
import { ModelGroup } from "@/components/llm_calls/fetch_models";
@@ -41,9 +42,9 @@ const SemanticKeywordMatching: React.FC<SemanticKeywordMatchingProps> = ({
<div>
<div className="flex items-center gap-2">
<Text className="font-medium">Semantic keyword matching</Text>
- <Tooltip title="Recognize related phrasing beyond exact keyword matches by comparing embeddings instead of plain text. Overrides direct keyword matching">
+ <SimpleTooltip content="Recognize related phrasing beyond exact keyword matches by comparing embeddings instead of plain text. Overrides direct keyword matching">
<InfoCircleOutlined className="text-gray-400" />
- </Tooltip>
+ </SimpleTooltip>
</div>
<Text className="text-gray-500 text-sm">
Uses same keyword-tier pairs as above and overrides direct keyword matching. Adds latency based on embedding
diff --git a/ui/litellm-dashboard/src/components/add_model/conditional_public_model_name.tsx b/ui/litellm-dashboard/src/components/add_model/conditional_public_model_name.tsx
index 8f95973b558..331f01ec1ec 100644
--- a/ui/litellm-dashboard/src/components/add_model/conditional_public_model_name.tsx
+++ b/ui/litellm-dashboard/src/components/add_model/conditional_public_model_name.tsx
@@ -1,7 +1,7 @@
import React, { useEffect, useState } from "react";
import { Form, Table } from "antd";
import { Input } from "@/components/ui/input";
-import { Tooltip } from "../atoms/index";
+import { SimpleTooltip } from "@/components/ui/tooltip";
import { Providers } from "../provider_info_helpers";
const ConditionalPublicModelName: React.FC = () => {
@@ -119,7 +119,7 @@ const ConditionalPublicModelName: React.FC = () => {
title: (
<span className="flex items-center">
Public Model Name
- <Tooltip content={publicNameTooltipContent} width="500px" />
+ <SimpleTooltip content={publicNameTooltipContent} width="500px" />
</span>
),
dataIndex: "public_name",
@@ -164,7 +164,7 @@ const ConditionalPublicModelName: React.FC = () => {
title: (
<span className="flex items-center">
LiteLLM Model Name
- <Tooltip content={liteLLMModelTooltipContent} width="360px" />
+ <SimpleTooltip content={liteLLMModelTooltipContent} width="360px" />
</span>
),
dataIndex: "litellm_model",
diff --git a/ui/litellm-dashboard/src/components/atoms/Tooltip.tsx b/ui/litellm-dashboard/src/components/atoms/Tooltip.tsx
deleted file mode 100644
index 02b03b518bf..00000000000
--- a/ui/litellm-dashboard/src/components/atoms/Tooltip.tsx
+++ /dev/null
@@ -1,40 +0,0 @@
-import React from "react";
-import { CircleHelp } from "lucide-react";
-
-import { Tooltip as ShadcnTooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "@/components/ui/tooltip";
-import { cn } from "@/lib/cva.config";
-
-interface TooltipProps {
- content: React.ReactNode;
- children?: React.ReactNode;
- width?: string;
- className?: string;
-}
-
-const widthClassNames: Record<string, string> = {
- "360px": "max-w-[360px]",
- "500px": "max-w-[500px]",
- auto: "max-w-xs",
-};
-
-export const Tooltip: React.FC<TooltipProps> = ({ content, children, width = "auto", className }) => (
- <TooltipProvider>
- <ShadcnTooltip>
- <TooltipTrigger
- render={
- <span
- className={cn(
- "inline-flex cursor-help items-center rounded-sm focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
- className,
- )}
- />
- }
- >
- {children ?? <CircleHelp aria-label="question-circle" className="ml-1 size-4 text-muted-foreground" />}
- </TooltipTrigger>
- <TooltipContent className={cn("whitespace-normal", widthClassNames[width] ?? "max-w-xs")}>
- {content}
- </TooltipContent>
- </ShadcnTooltip>
- </TooltipProvider>
-);
diff --git a/ui/litellm-dashboard/src/components/atoms/index.ts b/ui/litellm-dashboard/src/components/atoms/index.ts
deleted file mode 100644
index 4b0a2f8749b..00000000000
--- a/ui/litellm-dashboard/src/components/atoms/index.ts
+++ /dev/null
@@ -1 +0,0 @@
-export { Tooltip } from "./Tooltip";
diff --git a/ui/litellm-dashboard/src/components/common_components/MemberTable.tsx b/ui/litellm-dashboard/src/components/common_components/MemberTable.tsx
index 19c2377bafe..2622c037558 100644
--- a/ui/litellm-dashboard/src/components/common_components/MemberTable.tsx
+++ b/ui/litellm-dashboard/src/components/common_components/MemberTable.tsx
@@ -1,4 +1,4 @@
-import { Tooltip } from "@/components/atoms/Tooltip";
+import { SimpleTooltip } from "@/components/ui/tooltip";
import { Member } from "@/components/networking";
import { StatusBadge } from "@/components/shared/table_cells";
import { Button } from "@/components/ui/button";
@@ -60,9 +60,9 @@ export default function MemberTable({
{roleTooltip ? (
<span className="inline-flex items-center gap-2">
{roleColumnTitle}
- <Tooltip content={roleTooltip}>
+ <SimpleTooltip content={roleTooltip}>
<Info className="size-3.5" />
- </Tooltip>
+ </SimpleTooltip>
</span>
) : (
roleColumnTitle
diff --git a/ui/litellm-dashboard/src/components/key_team_helpers/BudgetFallbacksEditor.tsx b/ui/litellm-dashboard/src/components/key_team_helpers/BudgetFallbacksEditor.tsx
index e58d289df8a..062aaaa1773 100644
--- a/ui/litellm-dashboard/src/components/key_team_helpers/BudgetFallbacksEditor.tsx
+++ b/ui/litellm-dashboard/src/components/key_team_helpers/BudgetFallbacksEditor.tsx
@@ -1,4 +1,5 @@
-import { Button, Select, Tooltip } from "antd";
+import { SimpleTooltip } from "@/components/ui/tooltip";
+import { Button, Select } from "antd";
import { ArrowDown, Plus, X } from "lucide-react";
import React, { useState } from "react";
@@ -128,12 +129,9 @@ export function BudgetFallbacksEditor({ value, onChange, availableModels }: Budg
getPopupContainer={(trigger) => trigger.parentElement || document.body}
maxTagCount="responsive"
maxTagPlaceholder={(omittedValues) => (
- <Tooltip
- styles={{ root: { pointerEvents: "none" } }}
- title={omittedValues.map(({ value: v }) => v).join(", ")}
- >
+ <SimpleTooltip content={omittedValues.map(({ value: v }) => v).join(", ")}>
<span>+{omittedValues.length} more</span>
- </Tooltip>
+ </SimpleTooltip>
)}
/>
{entry.fallbackModels.length > 1 && (
diff --git a/ui/litellm-dashboard/src/components/model_info_view.tsx b/ui/litellm-dashboard/src/components/model_info_view.tsx
index ec804ee889b..5fb3c18f9b6 100644
--- a/ui/litellm-dashboard/src/components/model_info_view.tsx
+++ b/ui/litellm-dashboard/src/components/model_info_view.tsx
@@ -7,7 +7,8 @@ import { KeyIcon, RefreshIcon, TrashIcon } from "@heroicons/react/outline";
import { Button } from "@/components/ui/button";
import { Card } from "@/components/ui/card";
import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs";
-import { Button as AntdButton, Modal, Tooltip } from "antd";
+import { SimpleTooltip } from "@/components/ui/tooltip";
+import { Button as AntdButton, Modal } from "antd";
import { applyPtuModelInfo } from "../utils/ptuModelInfo";
import { usePtuCostAttributionEnabled } from "@/app/(dashboard)/hooks/uiSettings/usePtuCostAttributionEnabled";
import { ArrowLeft, CheckIcon, CopyIcon } from "lucide-react";
@@ -685,11 +686,11 @@ export default function ModelInfoView({
<Card className="block p-6">
<p className="text-sm">LiteLLM Model</p>
<div className="mt-2 overflow-hidden">
- <Tooltip title={modelData.litellm_model_name || "Not Set"}>
+ <SimpleTooltip content={modelData.litellm_model_name || "Not Set"} className="w-full min-w-0">
<div className="break-all text-sm font-medium leading-relaxed cursor-pointer">
{modelData.litellm_model_name || "Not Set"}
</div>
- </Tooltip>
+ </SimpleTooltip>
</div>
</Card>
<Card className="block p-6">
@@ -751,9 +752,9 @@ export default function ModelInfoView({
</Button>
)
) : (
- <Tooltip title="Only DB models can be edited. You must be an admin or the creator of the model to edit it.">
+ <SimpleTooltip content="Only DB models can be edited. You must be an admin or the creator of the model to edit it.">
<InfoCircleOutlined />
- </Tooltip>
+ </SimpleTooltip>
)}
</div>
</div>
diff --git a/ui/litellm-dashboard/src/components/shared/InheritedBudgetHint.tsx b/ui/litellm-dashboard/src/components/shared/InheritedBudgetHint.tsx
index 6be1dad564f..5fc80758cfd 100644
--- a/ui/litellm-dashboard/src/components/shared/InheritedBudgetHint.tsx
+++ b/ui/litellm-dashboard/src/components/shared/InheritedBudgetHint.tsx
@@ -1,6 +1,6 @@
"use client";
-import { Tooltip } from "@/components/atoms/Tooltip";
+import { SimpleTooltip } from "@/components/ui/tooltip";
import type { Team } from "@/components/key_team_helpers/key_list";
import type { Organization } from "@/components/networking";
import { formatNumberWithCommas } from "@/utils/dataUtils";
@@ -53,7 +53,7 @@ interface InheritedBudgetHintProps {
export function InheritedBudgetHint({ gates }: InheritedBudgetHintProps) {
if (gates.length === 0) return null;
return (
- <Tooltip
+ <SimpleTooltip
content={
<div data-testid="inherited-budget-hint" className="flex flex-col gap-1">
<span>This key has no budget of its own, but its spend still counts toward:</span>
diff --git a/ui/litellm-dashboard/src/components/team/LoggingSettings.tsx b/ui/litellm-dashboard/src/components/team/LoggingSettings.tsx
index 0fc936159fa..159f8fa0b74 100644
--- a/ui/litellm-dashboard/src/components/team/LoggingSettings.tsx
+++ b/ui/litellm-dashboard/src/components/team/LoggingSettings.tsx
@@ -1,6 +1,7 @@
/* eslint-disable react/no-unescaped-entities */
import React from "react";
-import { Select, Tooltip, Divider } from "antd";
+import { SimpleTooltip } from "@/components/ui/tooltip";
+import { Select, Divider } from "antd";
import { InfoCircleOutlined } from "@ant-design/icons";
import { Button } from "@/components/ui/button";
import { Badge } from "@/components/ui/badge";
@@ -191,9 +192,9 @@ const LoggingSettings: React.FC<LoggingSettingsProps> = ({
<div className="flex items-center space-x-2">
<BanIcon className="w-5 h-5 text-destructive" />
<span className="text-base font-semibold text-foreground">Disabled Callbacks</span>
- <Tooltip title="Select callbacks to disable for this key. Disabled callbacks will not receive any logging data.">
+ <SimpleTooltip content="Select callbacks to disable for this key. Disabled callbacks will not receive any logging data.">
<InfoCircleOutlined className="text-muted-foreground cursor-help" />
- </Tooltip>
+ </SimpleTooltip>
</div>
<div className="space-y-2">
@@ -210,7 +211,7 @@ const LoggingSettings: React.FC<LoggingSettingsProps> = ({
const description = callbackInfo[callbackName]?.description;
return (
<Option key={callbackName} value={callbackName} label={callbackName}>
- <Tooltip title={description} placement="right">
+ <SimpleTooltip content={description} side="right">
<div className="flex items-center space-x-2">
<Logo
src={callbackInfo[callbackName]?.logo}
@@ -219,7 +220,7 @@ const LoggingSettings: React.FC<LoggingSettingsProps> = ({
/>
<span>{callbackName}</span>
</div>
- </Tooltip>
+ </SimpleTooltip>
</Option>
);
})}
@@ -237,9 +238,9 @@ const LoggingSettings: React.FC<LoggingSettingsProps> = ({
<div className="flex items-center space-x-2">
<CogIcon className="w-5 h-5 text-foreground" />
<span className="text-base font-semibold text-foreground">Logging Integrations</span>
- <Tooltip title="Configure callback logging integrations for this team.">
+ <SimpleTooltip content="Configure callback logging integrations for this team.">
<InfoCircleOutlined className="text-muted-foreground cursor-help" />
- </Tooltip>
+ </SimpleTooltip>
</div>
<Button variant="secondary" onClick={addLoggingConfig} size="sm" type="button">
<Plus />
@@ -295,7 +296,7 @@ const LoggingSettings: React.FC<LoggingSettingsProps> = ({
const description = callbackInfo[callbackName]?.description;
return (
<Option key={callbackName} value={callbackName} label={callbackName}>
- <Tooltip title={description} placement="right">
+ <SimpleTooltip content={description} side="right">
<div className="flex items-center space-x-2">
<Logo
src={callbackInfo[callbackName]?.logo}
@@ -304,7 +305,7 @@ const LoggingSettings: React.FC<LoggingSettingsProps> = ({
/>
<span>{callbackName}</span>
</div>
- </Tooltip>
+ </SimpleTooltip>
</Option>
);
})}
diff --git a/ui/litellm-dashboard/src/components/team/MyUserTab.tsx b/ui/litellm-dashboard/src/components/team/MyUserTab.tsx
index fd40c30e93b..9aae6a25dc2 100644
--- a/ui/litellm-dashboard/src/components/team/MyUserTab.tsx
+++ b/ui/litellm-dashboard/src/components/team/MyUserTab.tsx
@@ -1,6 +1,6 @@
import { formatBudgetReset } from "@/utils/budgetUtils";
import { formatNumberWithCommas } from "@/utils/dataUtils";
-import { Tooltip } from "@/components/atoms/Tooltip";
+import { SimpleTooltip } from "@/components/ui/tooltip";
import { Badge } from "@/components/ui/badge";
import { Card, CardContent } from "@/components/ui/card";
import { CircleHelp } from "lucide-react";
@@ -14,9 +14,9 @@ interface MyUserTabProps {
const labelWithTooltip = (label: string, tooltip: string) => (
<span className="flex items-center gap-1 text-muted-foreground">
{label}
- <Tooltip content={tooltip}>
+ <SimpleTooltip content={tooltip}>
<CircleHelp className="size-4" aria-label={`${label} information`} />
- </Tooltip>
+ </SimpleTooltip>
</span>
);
diff --git a/ui/litellm-dashboard/src/components/team/TeamMemberTab.tsx b/ui/litellm-dashboard/src/components/team/TeamMemberTab.tsx
index ddc43ac50f1..a662a02f91e 100644
--- a/ui/litellm-dashboard/src/components/team/TeamMemberTab.tsx
+++ b/ui/litellm-dashboard/src/components/team/TeamMemberTab.tsx
@@ -1,6 +1,6 @@
import { useUISettings } from "@/app/(dashboard)/hooks/uiSettings/useUISettings";
import useAuthorized from "@/app/(dashboard)/hooks/useAuthorized";
-import { Tooltip } from "@/components/atoms/Tooltip";
+import { SimpleTooltip } from "@/components/ui/tooltip";
import MemberTable from "@/components/common_components/MemberTable";
import { Member } from "@/components/networking";
import { DateCell, MoneyCell } from "@/components/shared/table_cells";
@@ -102,9 +102,9 @@ export default function TeamMemberTab({
title: (
<span className="flex items-center gap-1">
Model Scope
- <Tooltip content="Models this member can access. Empty means they inherit all team models.">
+ <SimpleTooltip content="Models this member can access. Empty means they inherit all team models.">
<CircleHelp className="size-4" aria-label="Model scope information" />
- </Tooltip>
+ </SimpleTooltip>
</span>
),
key: "model_scope",
@@ -123,9 +123,9 @@ export default function TeamMemberTab({
</code>
))}
{remaining > 0 && (
- <Tooltip content={models.slice(2).join(", ")}>
+ <SimpleTooltip content={models.slice(2).join(", ")}>
<span className="text-muted-foreground">+{remaining} more</span>
- </Tooltip>
+ </SimpleTooltip>
)}
</div>
);
@@ -135,9 +135,9 @@ export default function TeamMemberTab({
title: (
<span className="flex items-center gap-1">
Current Cycle Spend (USD)
- <Tooltip content="Spend for the current budget cycle. Resets to $0 when the member's budget window rolls over. This is the value checked against the member's budget.">
+ <SimpleTooltip content="Spend for the current budget cycle. Resets to $0 when the member's budget window rolls over. This is the value checked against the member's budget.">
<CircleHelp className="size-4" aria-label="Current cycle spend information" />
- </Tooltip>
+ </SimpleTooltip>
</span>
),
key: "spend",
@@ -149,9 +149,9 @@ export default function TeamMemberTab({
title: (
<span className="flex items-center gap-1">
Total Spend (USD)
- <Tooltip content="Cumulative spend by this member within this team, across all budget cycles. Tracking began 2026-04-21; spend from before that date is not included.">
+ <SimpleTooltip content="Cumulative spend by this member within this team, across all budget cycles. Tracking began 2026-04-21; spend from before that date is not included.">
<CircleHelp className="size-4" aria-label="Total spend information" />
- </Tooltip>
+ </SimpleTooltip>
</span>
),
key: "total_spend",
@@ -173,9 +173,9 @@ export default function TeamMemberTab({
title: (
<span className="flex items-center gap-1">
Team Member Rate Limits
- <Tooltip content="Rate limits for this member's usage within this team.">
+ <SimpleTooltip content="Rate limits for this member's usage within this team.">
<CircleHelp className="size-4" aria-label="Team member rate limits information" />
- </Tooltip>
+ </SimpleTooltip>
</span>
),
key: "rate_limits",
diff --git a/ui/litellm-dashboard/src/components/team/TeamVirtualKeysTable.tsx b/ui/litellm-dashboard/src/components/team/TeamVirtualKeysTable.tsx
index f4097b082f8..bd7faa41ee9 100644
--- a/ui/litellm-dashboard/src/components/team/TeamVirtualKeysTable.tsx
+++ b/ui/litellm-dashboard/src/components/team/TeamVirtualKeysTable.tsx
@@ -1,6 +1,6 @@
"use client";
import { useKeys } from "@/app/(dashboard)/hooks/keys/useKeys";
-import { Tooltip } from "@/components/atoms/Tooltip";
+import { SimpleTooltip } from "@/components/ui/tooltip";
import CopyButton from "@/components/shared/CopyButton";
import { DateCell, IdCell, MoneyCell } from "@/components/shared/table_cells";
import {
@@ -150,9 +150,9 @@ export function TeamVirtualKeysTable({ teamId, teamAlias, organization }: TeamVi
cell: (info) => {
const value = info.getValue() as string;
return (
- <Tooltip content={value}>
+ <SimpleTooltip content={value}>
<span className="block max-w-full truncate font-mono text-xs">{value ?? "-"}</span>
- </Tooltip>
+ </SimpleTooltip>
);
},
},
@@ -182,9 +182,9 @@ export function TeamVirtualKeysTable({ teamId, teamAlias, organization }: TeamVi
const user = info.getValue() as { user_email?: string } | undefined;
const value = user?.user_email;
return (
- <Tooltip content={value}>
+ <SimpleTooltip content={value}>
<span className="block max-w-full truncate font-mono text-xs">{value ?? "-"}</span>
- </Tooltip>
+ </SimpleTooltip>
);
},
},
@@ -198,9 +198,9 @@ export function TeamVirtualKeysTable({ teamId, teamAlias, organization }: TeamVi
const userId = info.getValue() as string | null;
const displayValue = userId === "default_user_id" ? "Default Proxy Admin" : userId;
return (
- <Tooltip content={displayValue}>
+ <SimpleTooltip content={displayValue}>
<span className="block max-w-full truncate font-mono text-xs">{displayValue ?? "-"}</span>
- </Tooltip>
+ </SimpleTooltip>
);
},
},
@@ -336,11 +336,11 @@ export function TeamVirtualKeysTable({ teamId, teamAlias, organization }: TeamVi
const models = info.getValue() as string[];
const scope = deriveKeyModelScope(info.row.original.allowed_routes, info.row.original.key_type);
const emptyModelsBadge = !scope.hasModelAccess ? (
- <Tooltip content={`Scoped to ${scope.label} routes; this key cannot call any models`}>
+ <SimpleTooltip content={`Scoped to ${scope.label} routes; this key cannot call any models`}>
<Badge variant="secondary" className="mb-1">
No model access
</Badge>
- </Tooltip>
+ </SimpleTooltip>
) : (
<Badge variant="destructive" className="mb-1">
All Proxy Models
diff --git a/ui/litellm-dashboard/src/components/atoms/Tooltip.test.tsx b/ui/litellm-dashboard/src/components/ui/tooltip.test.tsx
similarity index 53%
rename from ui/litellm-dashboard/src/components/atoms/Tooltip.test.tsx
rename to ui/litellm-dashboard/src/components/ui/tooltip.test.tsx
index 4e0b64ea6de..788849047c6 100644
--- a/ui/litellm-dashboard/src/components/atoms/Tooltip.test.tsx
+++ b/ui/litellm-dashboard/src/components/ui/tooltip.test.tsx
@@ -1,19 +1,19 @@
import { describe, it, expect } from "vitest";
import { render, screen } from "@testing-library/react";
import userEvent from "@testing-library/user-event";
-import { Tooltip } from "./Tooltip";
+import { SimpleTooltip } from "./tooltip";
-describe("Tooltip", () => {
+describe("SimpleTooltip", () => {
it("should render", () => {
- render(<Tooltip content="Help text" />);
+ render(<SimpleTooltip content="Help text" />);
expect(screen.getByLabelText("question-circle")).toBeInTheDocument();
});
it("should render children instead of the default icon when provided", () => {
render(
- <Tooltip content="Help text">
+ <SimpleTooltip content="Help text">
<button>Info</button>
- </Tooltip>,
+ </SimpleTooltip>,
);
expect(screen.getByRole("button", { name: /info/i })).toBeInTheDocument();
expect(screen.queryByLabelText("question-circle")).not.toBeInTheDocument();
@@ -21,7 +21,7 @@ describe("Tooltip", () => {
it("should show tooltip content on mouse enter", async () => {
const user = userEvent.setup();
- render(<Tooltip content="Help text" />);
+ render(<SimpleTooltip content="Help text" />);
await user.hover(screen.getByLabelText("question-circle"));
@@ -30,7 +30,7 @@ describe("Tooltip", () => {
it("should hide tooltip content on mouse leave", async () => {
const user = userEvent.setup();
- render(<Tooltip content="Help text" />);
+ render(<SimpleTooltip content="Help text" />);
await user.hover(screen.getByLabelText("question-circle"));
expect(screen.getByText("Help text")).toBeInTheDocument();
@@ -40,7 +40,31 @@ describe("Tooltip", () => {
});
it("should not show tooltip content before hovering", () => {
- render(<Tooltip content="Help text" />);
+ render(<SimpleTooltip content="Help text" />);
expect(screen.queryByText("Help text")).not.toBeInTheDocument();
});
+
+ it("should keep rendering children when there is no content to show", async () => {
+ const user = userEvent.setup();
+ render(
+ <SimpleTooltip content={undefined}>
+ <button>Pick a rubric</button>
+ </SimpleTooltip>,
+ );
+
+ const trigger = screen.getByRole("button", { name: /pick a rubric/i });
+ await user.hover(trigger);
+
+ expect(trigger).toBeInTheDocument();
+ expect(document.querySelector('[data-slot="tooltip-content"]')).toBeNull();
+ });
+
+ it("should place the tooltip on the requested side", async () => {
+ const user = userEvent.setup();
+ render(<SimpleTooltip content="Help text" side="right" />);
+
+ await user.hover(screen.getByLabelText("question-circle"));
+
+ expect(await screen.findByText("Help text")).toHaveAttribute("data-side", "right");
+ });
});
diff --git a/ui/litellm-dashboard/src/components/ui/tooltip.tsx b/ui/litellm-dashboard/src/components/ui/tooltip.tsx
index 5e21eab67f5..e3b2f9d864d 100644
--- a/ui/litellm-dashboard/src/components/ui/tooltip.tsx
+++ b/ui/litellm-dashboard/src/components/ui/tooltip.tsx
@@ -1,6 +1,8 @@
"use client";
+import React from "react";
import { Tooltip as TooltipPrimitive } from "@base-ui/react/tooltip";
+import { CircleHelp } from "lucide-react";
import { cn } from "@/lib/cva.config";
@@ -51,4 +53,42 @@ function TooltipContent({
);
}
-export { Tooltip, TooltipTrigger, TooltipContent, TooltipProvider };
+interface SimpleTooltipProps {
+ content: React.ReactNode;
+ children?: React.ReactNode;
+ width?: string;
+ className?: string;
+ side?: React.ComponentProps<typeof TooltipContent>["side"];
+}
+
+const widthClassNames: Record<string, string> = {
+ "360px": "max-w-[360px]",
+ "500px": "max-w-[500px]",
+ auto: "max-w-xs",
+};
+
+const triggerClassName = (className?: string): string =>
+ cn(
+ "inline-flex cursor-help items-center rounded-sm focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
+ className,
+ );
+
+const defaultTrigger = <CircleHelp aria-label="question-circle" className="ml-1 size-4 text-muted-foreground" />;
+
+const SimpleTooltip: React.FC<SimpleTooltipProps> = ({ content, children, width = "auto", className, side }) =>
+ content === undefined || content === null || content === "" ? (
+ <span className={triggerClassName(className)}>{children ?? defaultTrigger}</span>
+ ) : (
+ <TooltipProvider>
+ <Tooltip>
+ <TooltipTrigger render={<span className={triggerClassName(className)} />}>
+ {children ?? defaultTrigger}
+ </TooltipTrigger>
+ <TooltipContent side={side} className={cn("whitespace-normal", widthClassNames[width] ?? "max-w-xs")}>
+ {content}
+ </TooltipContent>
+ </Tooltip>
+ </TooltipProvider>
+ );
+
+export { Tooltip, TooltipTrigger, TooltipContent, TooltipProvider, SimpleTooltip };