Composio powers 1000+ toolkits, tool search, context management, authentication, and a sandboxed workbench to help you build AI agents that turn intent into action.
Mirrored from https://github.com/Camo67/composio.git
Synced Nov 22, 10:45 UTC
fix(docs): handle toolkit icon load failures with proper fallback
CSS backgroundImage has no error events, so when external logo URLs fail to load the icon box appears empty. Switch to <img> with onError handler to fall back to the first letter of the toolkit name. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Sushmithamallesh committed
Feb 9, 2026 at 11:25 UTC
a66d8736e4ae8aef635d69a472e4663c2b07ff05
2 files changed
+28
-16
docs/components/toolkits/toolkit-detail.tsx
+14
-8
@@ -16,15 +16,21 @@ interface ToolkitDetailProps {
16
}
17
18
function ToolkitIcon({ toolkit }: { toolkit: Toolkit }) {
19
+ const [imgFailed, setImgFailed] = useState(false);
20
+ const fallback = (toolkit.name?.trim() || toolkit.slug).charAt(0).toUpperCase();
21
+
22
return (
20
- <div
21
- className="flex h-16 w-16 shrink-0 items-center justify-center rounded-xl border border-fd-border bg-fd-card bg-center bg-no-repeat text-xl font-semibold text-fd-muted-foreground shadow-sm"
22
- style={toolkit.logo ? {
23
- backgroundImage: `url(${toolkit.logo})`,
24
- backgroundSize: '60%',
25
- } : undefined}
26
- >
27
- {!toolkit.logo && (toolkit.name?.trim() || toolkit.slug).charAt(0).toUpperCase()}
23
+ <div className="flex h-16 w-16 shrink-0 items-center justify-center rounded-xl border border-fd-border bg-fd-card text-xl font-semibold text-fd-muted-foreground shadow-sm">
24
+ {toolkit.logo && !imgFailed ? (
25
+ <img
26
+ src={toolkit.logo}
27
+ alt=""
28
+ className="h-[60%] w-[60%] object-contain"
29
+ onError={() => setImgFailed(true)}
30
+ />
31
+ ) : (
32
+ fallback
33
+ )}
34
</div>
35
);
36
}
docs/components/toolkits/toolkits-landing.tsx
+14
-8
@@ -23,15 +23,21 @@ const POPULAR_SLUGS = [
23
];
24
25
function ToolkitIcon({ toolkit }: { toolkit: ToolkitSummary }) {
26
+ const [imgFailed, setImgFailed] = useState(false);
27
+ const fallback = toolkit.name.trim().charAt(0).toUpperCase();
28
+
29
return (
27
- <div
28
- className="flex h-9 w-9 shrink-0 items-center justify-center rounded-lg border border-fd-border/50 bg-fd-background bg-center bg-no-repeat text-sm font-medium text-fd-muted-foreground sm:h-10 sm:w-10"
29
- style={toolkit.logo ? {
30
- backgroundImage: `url(${toolkit.logo})`,
31
- backgroundSize: '65%',
32
- } : undefined}
33
- >
34
- {!toolkit.logo && toolkit.name.trim().charAt(0).toUpperCase()}
30
+ <div className="flex h-9 w-9 shrink-0 items-center justify-center rounded-lg border border-fd-border/50 bg-fd-background text-sm font-medium text-fd-muted-foreground sm:h-10 sm:w-10">
31
+ {toolkit.logo && !imgFailed ? (
32
+ <img
33
+ src={toolkit.logo}
34
+ alt=""
35
+ className="h-[65%] w-[65%] object-contain"
36
+ onError={() => setImgFailed(true)}
37
+ />
38
+ ) : (
39
+ fallback
40
+ )}
41
</div>
42
);
43
}