Skip to content

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

Sushmithamallesh3bd4aa942ba3
diff --git a/docs/components/ask-ai-button.tsx b/docs/components/ask-ai-button.tsx
index d80f1a2df..f851f43db 100644
--- a/docs/components/ask-ai-button.tsx
+++ b/docs/components/ask-ai-button.tsx
@@ -11,8 +11,17 @@ function getDecimal() {
return (window as typeof window & { Decimal?: DecimalAPI }).Decimal;
}
-function showDecimalWidget() {
- getDecimal()?.show();
+let isDecimalOpen = false;
+
+function toggleDecimalWidget() {
+ const decimal = getDecimal();
+ if (!decimal) return;
+ if (isDecimalOpen) {
+ decimal.hide();
+ } else {
+ decimal.show();
+ }
+ isDecimalOpen = !isDecimalOpen;
}
function useIsMac() {
@@ -32,7 +41,7 @@ function useAskAIShortcut() {
function handleKeyDown(e: KeyboardEvent) {
if ((e.metaKey || e.ctrlKey) && e.key === 'i') {
e.preventDefault();
- showDecimalWidget();
+ toggleDecimalWidget();
}
}
document.addEventListener('keydown', handleKeyDown);
@@ -72,7 +81,7 @@ export function SearchAndAskAI() {
)}
<button
type="button"
- onClick={showDecimalWidget}
+ onClick={toggleDecimalWidget}
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"
>
Ask AI
@@ -105,7 +114,7 @@ export function SearchAndAskAIMobile() {
<button
type="button"
aria-label="Ask AI"
- onClick={showDecimalWidget}
+ onClick={toggleDecimalWidget}
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"
>
<MessageSquare className="size-4.5" />