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() on button click and ⌘I
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Sushmithamallesh committed
Feb 19, 2026 at 16:20 UTC
3bd4aa942ba3352f33547763f72ebca07ff27a1e
1 file changed
+14
-5
docs/components/ask-ai-button.tsx
+14
-5
@@ -11,8 +11,17 @@ function getDecimal() {
11
return (window as typeof window & { Decimal?: DecimalAPI }).Decimal;
12
}
13
14
-function showDecimalWidget() {
15
- getDecimal()?.show();
14
+let isDecimalOpen = false;
15
+
16
+function toggleDecimalWidget() {
17
+ const decimal = getDecimal();
18
+ if (!decimal) return;
19
+ if (isDecimalOpen) {
20
+ decimal.hide();
21
+ } else {
22
+ decimal.show();
23
+ }
24
+ isDecimalOpen = !isDecimalOpen;
25
}
26
27
function useIsMac() {
@@ -32,7 +41,7 @@ function useAskAIShortcut() {
41
function handleKeyDown(e: KeyboardEvent) {
42
if ((e.metaKey || e.ctrlKey) && e.key === 'i') {
43
e.preventDefault();
35
- showDecimalWidget();
44
+ toggleDecimalWidget();
45
}
46
}
47
document.addEventListener('keydown', handleKeyDown);
@@ -72,7 +81,7 @@ export function SearchAndAskAI() {
81
)}
82
<button
83
type="button"
75
- onClick={showDecimalWidget}
84
+ onClick={toggleDecimalWidget}
85
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"
86
>
87
Ask AI
@@ -105,7 +114,7 @@ export function SearchAndAskAIMobile() {
114
<button
115
type="button"
116
aria-label="Ask AI"
108
- onClick={showDecimalWidget}
117
+ onClick={toggleDecimalWidget}
118
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"
119
>
120
<MessageSquare className="size-4.5" />