Skip to content

SmythOS Studio: Open-Source Visual AI Agent Builder and deployable runtime stack from SmythOS. Start with an intuitive drag-and-drop workspace, extend with custom code, and deploy your agents anywhere — local, cloud, or edge — with full governance and control.

Replace Flowbite tooltips with custom Radix UI tooltips

samme-abdulfc752404e1c3
diff --git a/packages/app/src/react/features/vault/components/api-keys.tsx b/packages/app/src/react/features/vault/components/api-keys.tsx
index 4e3c6c1c..414d3cf4 100644
--- a/packages/app/src/react/features/vault/components/api-keys.tsx
+++ b/packages/app/src/react/features/vault/components/api-keys.tsx
@@ -15,9 +15,9 @@ import { Input } from '@src/react/shared/components/ui/input';
import { Label } from '@src/react/shared/components/ui/label';
import { Button as CustomButton } from '@src/react/shared/components/ui/newDesign/button';
import { TextArea } from '@src/react/shared/components/ui/newDesign/textarea';
+import { Tooltip, TooltipContent, TooltipTrigger } from '@src/react/shared/components/ui/tooltip';
import { errorToast, successToast } from '@src/shared/components/toast';
import classNames from 'classnames';
-import { Tooltip } from 'flowbite-react';
import { Check, Copy, Info, Pencil, Trash2 } from 'lucide-react';
import { FC, useEffect, useState } from 'react';
import { FaPlus } from 'react-icons/fa';
@@ -402,11 +402,16 @@ export function ApiKeys({ pageAccess }: { pageAccess: { write: boolean } }) {
<div className="flex items-center justify-between mb-4 pr-2 flex-wrap">
<h2 className="flex items-center gap-2 text-lg font-semibold">
API Keys
- <Tooltip
- className="w-72 text-center"
- content="Add API keys by providing a token (up to 10,000 characters), a unique name, and selecting a scope: All, API Call, Hugging Face, or Zapier Action."
- >
- <Info className="w-4 h-4" />
+ <Tooltip>
+ <TooltipTrigger asChild>
+ <Info className="w-4 h-4 cursor-help" />
+ </TooltipTrigger>
+ <TooltipContent className="w-72 text-center">
+ <p>
+ Add API keys by providing a token (up to 10,000 characters), a unique name, and
+ selecting a scope: All, API Call, Hugging Face, or Zapier Action.
+ </p>
+ </TooltipContent>
</Tooltip>
</h2>
{pageAccess?.write && (
@@ -442,47 +447,62 @@ export function ApiKeys({ pageAccess }: { pageAccess: { write: boolean } }) {
</td>
<td className="pl-4 py-2">
<div className="flex justify-end">
- <Tooltip content={copiedKeyId === key.id ? 'Copied!' : 'Copy'}>
- <Button
- variant="ghost"
- size="sm"
- onClick={() => handleCopy(key.key, key.id)}
- >
- {copiedKeyId === key.id ? (
- <Check className="h-4 w-4 text-green-500" />
- ) : (
- <Copy className="h-4 w-4" />
- )}
- </Button>
- </Tooltip>
- {pageAccess?.write && (
- <Tooltip content="Edit">
+ <Tooltip>
+ <TooltipTrigger asChild>
<Button
variant="ghost"
size="sm"
- disabled={key.scope?.includes('CUSTOM_LLM')}
- onClick={() => {
- setSelectedKey(key);
- setEditModalOpen(true);
- }}
+ onClick={() => handleCopy(key.key, key.id)}
>
- <Pencil className="h-4 w-4" />
+ {copiedKeyId === key.id ? (
+ <Check className="h-4 w-4 text-green-500" />
+ ) : (
+ <Copy className="h-4 w-4" />
+ )}
</Button>
+ </TooltipTrigger>
+ <TooltipContent>
+ <p>{copiedKeyId === key.id ? 'Copied!' : 'Copy'}</p>
+ </TooltipContent>
+ </Tooltip>
+ {pageAccess?.write && (
+ <Tooltip>
+ <TooltipTrigger asChild>
+ <Button
+ variant="ghost"
+ size="sm"
+ disabled={key.scope?.includes('CUSTOM_LLM')}
+ onClick={() => {
+ setSelectedKey(key);
+ setEditModalOpen(true);
+ }}
+ >
+ <Pencil className="h-4 w-4" />
+ </Button>
+ </TooltipTrigger>
+ <TooltipContent>
+ <p>Edit</p>
+ </TooltipContent>
</Tooltip>
)}
{pageAccess?.write && (
- <Tooltip content="Delete">
- <Button
- variant="ghost"
- size="sm"
- disabled={key.scope?.includes('CUSTOM_LLM')}
- onClick={() => {
- setSelectedKey(key);
- setDeleteModalOpen(true);
- }}
- >
- <Trash2 className="h-4 w-4 hover:text-red-500" />
- </Button>
+ <Tooltip>
+ <TooltipTrigger asChild>
+ <Button
+ variant="ghost"
+ size="sm"
+ disabled={key.scope?.includes('CUSTOM_LLM')}
+ onClick={() => {
+ setSelectedKey(key);
+ setDeleteModalOpen(true);
+ }}
+ >
+ <Trash2 className="h-4 w-4 hover:text-red-500" />
+ </Button>
+ </TooltipTrigger>
+ <TooltipContent>
+ <p>Delete</p>
+ </TooltipContent>
</Tooltip>
)}
</div>
diff --git a/packages/app/src/react/features/vault/components/oauth-connections.tsx b/packages/app/src/react/features/vault/components/oauth-connections.tsx
index 88762cbb..f2fe7eb3 100644
--- a/packages/app/src/react/features/vault/components/oauth-connections.tsx
+++ b/packages/app/src/react/features/vault/components/oauth-connections.tsx
@@ -1,6 +1,7 @@
// src/webappv2/pages/vault/oauth-connections.tsx
import { Button } from '@src/react/shared/components/ui/button'; // Standard Button component for consistency
import { Button as CustomButton } from '@src/react/shared/components/ui/newDesign/button'; // Your custom button
+import { Tooltip, TooltipContent, TooltipTrigger } from '@src/react/shared/components/ui/tooltip';
import { errorToast, successToast } from '@src/shared/components/toast';
import {
extractPlatformFromUrl,
@@ -8,7 +9,6 @@ import {
mapOAuthTypeDisplay,
} from '@src/shared/helpers/oauth/oauth.utils';
import { useQueryClient } from '@tanstack/react-query'; // Import useQueryClient
-import { Tooltip } from 'flowbite-react';
import { Circle, CopyPlus, Info, Pencil, PlusCircle, Trash2 } from 'lucide-react';
import React, { useCallback, useEffect, useState } from 'react';
import {
@@ -346,11 +346,16 @@ export function OAuthConnections() {
<div className="flex items-center justify-between mb-4 pr-2 flex-wrap">
<h2 className="flex items-center gap-2 text-lg font-semibold">
OAuth Connections
- <Tooltip
- className="w-72 text-center"
- content="Manage OAuth connections to authenticate and integrate with external services and APIs"
- >
- <Info className="w-4 h-4" />
+ <Tooltip>
+ <TooltipTrigger asChild>
+ <Info className="w-4 h-4 cursor-help" />
+ </TooltipTrigger>
+ <TooltipContent className="w-72 text-center">
+ <p>
+ Manage OAuth connections to authenticate and integrate with external services and
+ APIs
+ </p>
+ </TooltipContent>
</Tooltip>
</h2>
</div>
@@ -460,39 +465,54 @@ export function OAuthConnections() {
))}
{/* Duplicate Button */}
- <Tooltip content="Duplicate">
- <Button
- variant="ghost"
- size="sm"
- onClick={() => handleDuplicateClick(conn)}
- disabled={isDisabled}
- >
- <CopyPlus className="h-4 w-4" />
- </Button>
+ <Tooltip>
+ <TooltipTrigger asChild>
+ <Button
+ variant="ghost"
+ size="sm"
+ onClick={() => handleDuplicateClick(conn)}
+ disabled={isDisabled}
+ >
+ <CopyPlus className="h-4 w-4" />
+ </Button>
+ </TooltipTrigger>
+ <TooltipContent>
+ <p>Duplicate</p>
+ </TooltipContent>
</Tooltip>
{/* Edit Button */}
- <Tooltip content="Edit">
- <Button
- variant="ghost"
- size="sm"
- onClick={() => handleEditClick(conn)}
- disabled={isDisabled}
- >
- <Pencil className="h-4 w-4" />
- </Button>
+ <Tooltip>
+ <TooltipTrigger asChild>
+ <Button
+ variant="ghost"
+ size="sm"
+ onClick={() => handleEditClick(conn)}
+ disabled={isDisabled}
+ >
+ <Pencil className="h-4 w-4" />
+ </Button>
+ </TooltipTrigger>
+ <TooltipContent>
+ <p>Edit</p>
+ </TooltipContent>
</Tooltip>
{/* Delete Button */}
- <Tooltip content="Delete">
- <Button
- variant="ghost"
- size="sm"
- onClick={() => handleDeleteClick(conn)}
- disabled={isDisabled}
- >
- <Trash2 className="h-4 w-4 hover:text-red-500" />
- </Button>
+ <Tooltip>
+ <TooltipTrigger asChild>
+ <Button
+ variant="ghost"
+ size="sm"
+ onClick={() => handleDeleteClick(conn)}
+ disabled={isDisabled}
+ >
+ <Trash2 className="h-4 w-4 hover:text-red-500" />
+ </Button>
+ </TooltipTrigger>
+ <TooltipContent>
+ <p>Delete</p>
+ </TooltipContent>
</Tooltip>
</div>
</td>
diff --git a/packages/app/src/react/features/vault/components/user-custom-models.tsx b/packages/app/src/react/features/vault/components/user-custom-models.tsx
index e8b9f239..e31e64d2 100644
--- a/packages/app/src/react/features/vault/components/user-custom-models.tsx
+++ b/packages/app/src/react/features/vault/components/user-custom-models.tsx
@@ -1,7 +1,7 @@
import { Button } from '@src/react/shared/components/ui/button';
import { Button as CustomButton } from '@src/react/shared/components/ui/newDesign/button';
+import { Tooltip, TooltipContent, TooltipTrigger } from '@src/react/shared/components/ui/tooltip';
import { errorToast, successToast } from '@src/shared/components/toast';
-import { Tooltip } from 'flowbite-react';
import { Info, Pencil, PlusCircle, Trash2 } from 'lucide-react';
import { useState } from 'react';
import {
@@ -151,11 +151,16 @@ export function UserCustomModels({ pageAccess }: { pageAccess: { write: boolean
<div className="flex items-center gap-3">
<div className="flex items-center gap-2 self-stretch text-[#1e1e1e] text-lg font-semibold font-['Inter'] leading-snug">
Custom Models
- <Tooltip
- className="w-72 text-center"
- content="Custom models allow you to connect to your own LLM instances running locally or on your infrastructure"
- >
- <Info className="w-4 h-4" />
+ <Tooltip>
+ <TooltipTrigger asChild>
+ <Info className="w-4 h-4 cursor-help" />
+ </TooltipTrigger>
+ <TooltipContent className="w-72 text-center">
+ <p>
+ Custom models allow you to connect to your own LLM instances running locally or on
+ your infrastructure
+ </p>
+ </TooltipContent>
</Tooltip>
</div>
</div>
@@ -189,25 +194,35 @@ export function UserCustomModels({ pageAccess }: { pageAccess: { write: boolean
<div className="flex items-center gap-2 ml-2">
{pageAccess.write && (
<>
- <Tooltip content="Edit">
- <Button
- variant="ghost"
- size="sm"
- onClick={() => handleEditModel(model)}
- className="h-8 w-8 p-0"
- >
- <Pencil className="h-4 w-4" />
- </Button>
+ <Tooltip>
+ <TooltipTrigger asChild>
+ <Button
+ variant="ghost"
+ size="sm"
+ onClick={() => handleEditModel(model)}
+ className="h-8 w-8 p-0"
+ >
+ <Pencil className="h-4 w-4" />
+ </Button>
+ </TooltipTrigger>
+ <TooltipContent>
+ <p>Edit</p>
+ </TooltipContent>
</Tooltip>
- <Tooltip content="Delete">
- <Button
- variant="ghost"
- size="sm"
- onClick={() => handleDeleteClick(model)}
- className="h-8 w-8 p-0"
- >
- <Trash2 className="h-4 w-4 hover:text-red-500" />
- </Button>
+ <Tooltip>
+ <TooltipTrigger asChild>
+ <Button
+ variant="ghost"
+ size="sm"
+ onClick={() => handleDeleteClick(model)}
+ className="h-8 w-8 p-0"
+ >
+ <Trash2 className="h-4 w-4 hover:text-red-500" />
+ </Button>
+ </TooltipTrigger>
+ <TooltipContent>
+ <p>Delete</p>
+ </TooltipContent>
</Tooltip>
</>
)}
diff --git a/packages/app/src/react/features/vault/components/user-models.tsx b/packages/app/src/react/features/vault/components/user-models.tsx
index c5ec30a7..e22b26e4 100644
--- a/packages/app/src/react/features/vault/components/user-models.tsx
+++ b/packages/app/src/react/features/vault/components/user-models.tsx
@@ -11,9 +11,9 @@ import {
} from '@src/react/shared/components/ui/dialog';
import { Button as CustomButton } from '@src/react/shared/components/ui/newDesign/button';
import { TextArea } from '@src/react/shared/components/ui/newDesign/textarea';
+import { Tooltip, TooltipContent, TooltipTrigger } from '@src/react/shared/components/ui/tooltip';
import { errorToast, successToast } from '@src/shared/components/toast';
import { GLOBAL_VAULT_KEYS, SMYTHOS_DOCS_URL } from '@src/shared/constants/general';
-import { Tooltip } from 'flowbite-react';
import { Check, Copy, Info, Pencil, Trash2 } from 'lucide-react';
import { useState } from 'react';
import { useVault } from '../hooks/use-vault';
@@ -231,11 +231,16 @@ export function UserModels({ pageAccess }: { pageAccess: { write: boolean } }) {
<div className="p-6">
<h2 className="flex items-center gap-2 text-lg font-semibold mb-4">
Your Own AI Models
- <Tooltip
- className="w-72 text-center"
- content="Bring and maintain your own AI models by adding API keys for OpenAI, Google, Anthropic, and other providers"
- >
- <Info className="w-4 h-4" />
+ <Tooltip>
+ <TooltipTrigger asChild>
+ <Info className="w-4 h-4 cursor-help" />
+ </TooltipTrigger>
+ <TooltipContent className="w-72 text-center">
+ <p>
+ Bring and maintain your own AI models by adding API keys for OpenAI, Google,
+ Anthropic, and other providers
+ </p>
+ </TooltipContent>
</Tooltip>
</h2>
<p className="text-sm text-muted-foreground mb-4">
@@ -270,54 +275,69 @@ export function UserModels({ pageAccess }: { pageAccess: { write: boolean } }) {
</div>
{hasKey ? (
<div className="flex items-center gap-1">
- <Tooltip content={copiedKeyId === model?.id ? 'Copied!' : 'Copy'}>
- <Button
- variant="ghost"
- size="sm"
- onClick={() => handleCopy(model?.id || '')}
- >
- {copiedKeyId === model?.id ? (
- <Check className="h-4 w-4 text-green-500" />
- ) : (
- <Copy className="h-4 w-4" />
- )}
- </Button>
- </Tooltip>
- {pageAccess?.write && (
- <Tooltip content="Edit">
+ <Tooltip>
+ <TooltipTrigger asChild>
<Button
variant="ghost"
size="sm"
- onClick={() =>
- setModalState({
- type: 'edit',
- model: {
- id: key,
- apiKey: model?.apiKey || '',
- icon: key.toLowerCase(),
- name: value?.['name'],
- },
- })
- }
+ onClick={() => handleCopy(model?.id || '')}
>
- <Pencil className="h-4 w-4" />
+ {copiedKeyId === model?.id ? (
+ <Check className="h-4 w-4 text-green-500" />
+ ) : (
+ <Copy className="h-4 w-4" />
+ )}
</Button>
+ </TooltipTrigger>
+ <TooltipContent>
+ <p>{copiedKeyId === model?.id ? 'Copied!' : 'Copy'}</p>
+ </TooltipContent>
+ </Tooltip>
+ {pageAccess?.write && (
+ <Tooltip>
+ <TooltipTrigger asChild>
+ <Button
+ variant="ghost"
+ size="sm"
+ onClick={() =>
+ setModalState({
+ type: 'edit',
+ model: {
+ id: key,
+ apiKey: model?.apiKey || '',
+ icon: key.toLowerCase(),
+ name: value?.['name'],
+ },
+ })
+ }
+ >
+ <Pencil className="h-4 w-4" />
+ </Button>
+ </TooltipTrigger>
+ <TooltipContent>
+ <p>Edit</p>
+ </TooltipContent>
</Tooltip>
)}
{pageAccess?.write && (
- <Tooltip content="Delete">
- <Button
- variant="ghost"
- size="sm"
- onClick={() =>
- setModalState({
- type: 'delete',
- model,
- })
- }
- >
- <Trash2 className="h-4 w-4 hover:text-red-500" />
- </Button>
+ <Tooltip>
+ <TooltipTrigger asChild>
+ <Button
+ variant="ghost"
+ size="sm"
+ onClick={() =>
+ setModalState({
+ type: 'delete',
+ model,
+ })
+ }
+ >
+ <Trash2 className="h-4 w-4 hover:text-red-500" />
+ </Button>
+ </TooltipTrigger>
+ <TooltipContent>
+ <p>Delete</p>
+ </TooltipContent>
</Tooltip>
)}
</div>
diff --git a/packages/app/src/react/features/vault/pages/VaultPage.tsx b/packages/app/src/react/features/vault/pages/VaultPage.tsx
index a52c7af0..7b233185 100644
--- a/packages/app/src/react/features/vault/pages/VaultPage.tsx
+++ b/packages/app/src/react/features/vault/pages/VaultPage.tsx
@@ -1,6 +1,7 @@
import { useAuthCtx } from '@react/shared/contexts/auth.context';
import { ErrorBoundarySuspense } from '@src/react/features/error-pages/higher-order-components/ErrorBoundary';
import { Button as CustomButton } from '@src/react/shared/components/ui/newDesign/button';
+import { TooltipProvider } from '@src/react/shared/components/ui/tooltip';
import { PluginComponents } from '@src/react/shared/plugins/PluginComponents';
import { PluginTarget } from '@src/react/shared/plugins/Plugins';
import { errorToast, successToast } from '@src/shared/components/toast';
@@ -57,40 +58,42 @@ export default function VaultPage() {
}
return (
- <div className="container mx-auto py-6 space-y-6 pl-12 md:pl-0 pr-0">
- <div className="flex items-center justify-between md:justify-end">
- {pageAccess?.write && (
- <CustomButton
- handleClick={handleExportVault}
- disabled={isExporting}
- Icon={
- isExporting ? (
- <Loader2 className="mr-2 h-4 w-4 animate-spin" />
- ) : (
- <CiExport className="inline mr-1 w-4 h-4" strokeWidth={1} />
- )
- }
- addIcon
- label={isExporting ? 'Exporting...' : 'Export Vault Structure'}
- />
- )}
- </div>
+ <TooltipProvider delayDuration={300} skipDelayDuration={100}>
+ <div className="container mx-auto py-6 space-y-6 pl-12 md:pl-0 pr-0">
+ <div className="flex items-center justify-between md:justify-end">
+ {pageAccess?.write && (
+ <CustomButton
+ handleClick={handleExportVault}
+ disabled={isExporting}
+ Icon={
+ isExporting ? (
+ <Loader2 className="mr-2 h-4 w-4 animate-spin" />
+ ) : (
+ <CiExport className="inline mr-1 w-4 h-4" strokeWidth={1} />
+ )
+ }
+ addIcon
+ label={isExporting ? 'Exporting...' : 'Export Vault Structure'}
+ />
+ )}
+ </div>
- {hasBuiltinModels && (
- <PluginComponents targetId={PluginTarget.VaultPageSmythOSRecommendedModels} />
- )}
+ {hasBuiltinModels && (
+ <PluginComponents targetId={PluginTarget.VaultPageSmythOSRecommendedModels} />
+ )}
- <UserModels pageAccess={pageAccess} />
- <UserCustomModels pageAccess={pageAccess} />
- <PluginComponents targetId={PluginTarget.VaultPageEnterpriseModels} />
- <OAuthConnections />
+ <UserModels pageAccess={pageAccess} />
+ <UserCustomModels pageAccess={pageAccess} />
+ <PluginComponents targetId={PluginTarget.VaultPageEnterpriseModels} />
+ <OAuthConnections />
- <ErrorBoundarySuspense
- loadingFallback={<div>Loading...</div>}
- errorFallback={() => <div>Error loading API keys</div>}
- >
- <ApiKeys pageAccess={pageAccess} />
- </ErrorBoundarySuspense>
- </div>
+ <ErrorBoundarySuspense
+ loadingFallback={<div>Loading...</div>}
+ errorFallback={() => <div>Error loading API keys</div>}
+ >
+ <ApiKeys pageAccess={pageAccess} />
+ </ErrorBoundarySuspense>
+ </div>
+ </TooltipProvider>
);
}
diff --git a/packages/app/src/react/shared/components/ui/tooltip.tsx b/packages/app/src/react/shared/components/ui/tooltip.tsx
new file mode 100644
index 00000000..e178b7b7
--- /dev/null
+++ b/packages/app/src/react/shared/components/ui/tooltip.tsx
@@ -0,0 +1,48 @@
+/**
+ * Shadcn-style Tooltip component built on Radix UI
+ *
+ * Official implementation with arrow support
+ * @see https://ui.shadcn.com/docs/components/tooltip
+ */
+import * as TooltipPrimitive from '@radix-ui/react-tooltip';
+import * as React from 'react';
+
+import { cn } from '@react/shared/utils/general';
+
+const TooltipProvider = TooltipPrimitive.Provider;
+
+const Tooltip = TooltipPrimitive.Root;
+
+const TooltipTrigger = TooltipPrimitive.Trigger;
+
+interface TooltipContentProps
+ extends React.ComponentPropsWithoutRef<typeof TooltipPrimitive.Content> {
+ /**
+ * Arrow fill color - should match tooltip background
+ * @default 'fill-gray-900'
+ */
+ arrowClassName?: string;
+}
+
+const TooltipContent = React.forwardRef<
+ React.ElementRef<typeof TooltipPrimitive.Content>,
+ TooltipContentProps
+>(({ className, sideOffset = 0, children, arrowClassName, ...props }, ref) => (
+ <TooltipPrimitive.Portal>
+ <TooltipPrimitive.Content
+ ref={ref}
+ sideOffset={sideOffset}
+ className={cn(
+ 'z-50 w-fit origin-(--radix-tooltip-content-transform-origin) rounded-md bg-gray-900 px-3 py-1.5 text-xs text-white text-balance animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2',
+ className,
+ )}
+ {...props}
+ >
+ {children}
+ <TooltipPrimitive.Arrow className={cn('fill-gray-900 z-50', arrowClassName)} />
+ </TooltipPrimitive.Content>
+ </TooltipPrimitive.Portal>
+));
+TooltipContent.displayName = TooltipPrimitive.Content.displayName;
+
+export { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger };