@devries-cameron20 / composio-1 / commits / 208d37d15
Fork 0

Composio powers 1000+ toolkits, tool search, context management, authentication, and a sandboxed workbench to help you build AI agents that turn intent into action.

docs: toggle Decimal widget with show()/hide() per Decimal's recommended pattern

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

Sushmithamallesh committed Feb 19, 2026 at 16:29 UTC 208d37d159841373debbb78a8a072c36c5574a1e
1 file changed +13 -7
docs/components/ask-ai-button.tsx
+13 -7
@@ -11,13 +11,19 @@ function getDecimal() {
11 return (window as typeof window & { Decimal?: DecimalAPI }).Decimal;
12 }
13
14 -function showDecimalWidget() {
14 +let widgetOpen = false;
15 +
16 +function toggleDecimalWidget() {
17 const decimal = getDecimal();
16 - if (decimal) {
17 - decimal.show();
18 + if (!decimal) {
19 + setTimeout(() => {
20 + getDecimal()?.show();
21 + widgetOpen = true;
22 + }, 500);
23 return;
24 }
20 - setTimeout(() => getDecimal()?.show(), 500);
25 + widgetOpen ? decimal.hide() : decimal.show();
26 + widgetOpen = !widgetOpen;
27 }
28
29 function useIsMac() {
@@ -31,7 +37,7 @@ function useIsMac() {
37 const handleKeyDown = (e: KeyboardEvent) => {
38 if ((e.metaKey || e.ctrlKey) && e.key === 'i') {
39 e.preventDefault();
34 - showDecimalWidget();
40 + toggleDecimalWidget();
41 }
42 };
43
@@ -71,7 +77,7 @@ export function SearchAndAskAI() {
77 )}
78 <button
79 type="button"
74 - onClick={showDecimalWidget}
80 + onClick={toggleDecimalWidget}
81 className="inline-flex items-center gap-2 rounded-lg border bg-fd-secondary/50 p-1.5 ps-2.5 text-sm text-fd-muted-foreground transition-colors hover:bg-fd-accent hover:text-fd-accent-foreground shrink-0"
82 >
83 Ask AI
@@ -104,7 +110,7 @@ export function SearchAndAskAIMobile() {
110 <button
111 type="button"
112 aria-label="Ask AI"
107 - onClick={showDecimalWidget}
113 + onClick={toggleDecimalWidget}
114 className="inline-flex items-center justify-center rounded-md p-2 text-sm font-medium transition-colors duration-100 hover:bg-fd-accent hover:text-fd-accent-foreground"
115 >
116 <MessageSquare className="size-4.5" />