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: make accordions linkable with auto-generated IDs

Sushmithamalleshec6e12335e7c
diff --git a/docs/app/global.css b/docs/app/global.css
index 7319e6303..8cd9dd982 100644
--- a/docs/app/global.css
+++ b/docs/app/global.css
@@ -521,6 +521,15 @@ p.text-fd-muted-foreground.not-prose:has(> code.text-xs) {
--color-fd-primary: var(--composio-orange);
}
+/* Accordion copy-link button: hidden by default, visible on hover */
+[data-accordion-value] button[aria-label="Copy Link"] {
+ opacity: 0;
+ transition: opacity 150ms;
+}
+[data-accordion-value]:hover button[aria-label="Copy Link"] {
+ opacity: 1;
+}
+
@layer base {
* {
@apply border-border outline-ring/50;
diff --git a/docs/components/toolkits/faq-section.tsx b/docs/components/toolkits/faq-section.tsx
index c20636e18..8dc62b687 100644
--- a/docs/components/toolkits/faq-section.tsx
+++ b/docs/components/toolkits/faq-section.tsx
@@ -23,7 +23,7 @@ export function FaqSection({ faq }: FaqSectionProps) {
</h2>
<Accordions type="single">
{faq.map((item) => (
- <Accordion key={item.question} title={item.question}>
+ <Accordion key={item.question} title={item.question} id={item.question.toLowerCase().replace(/[^a-z0-9]+/g, '-').replace(/(^-|-$)/g, '')}>
<div
className="prose prose-sm prose-fd max-w-none text-fd-muted-foreground"
dangerouslySetInnerHTML={{ __html: item.answer }}
diff --git a/docs/mdx-components.tsx b/docs/mdx-components.tsx
index 1edf49183..0e7d0387c 100644
--- a/docs/mdx-components.tsx
+++ b/docs/mdx-components.tsx
@@ -3,7 +3,16 @@ import type { MDXComponents } from 'mdx/types';
import { Heading } from '@/components/heading';
import { YouTube } from '@/components/youtube';
import { Tabs, Tab, TabsList, TabsTrigger, TabsContent } from 'fumadocs-ui/components/tabs';
-import { Accordion, Accordions } from 'fumadocs-ui/components/accordion';
+import { Accordion as BaseAccordion, Accordions } from 'fumadocs-ui/components/accordion';
+import type { ComponentProps } from 'react';
+
+function slugify(text: string): string {
+ return text.toLowerCase().replace(/[^a-z0-9]+/g, '-').replace(/(^-|-$)/g, '');
+}
+
+function Accordion({ id, title, ...props }: ComponentProps<typeof BaseAccordion>) {
+ return <BaseAccordion id={id ?? (typeof title === 'string' ? slugify(title) : undefined)} title={title} {...props} />;
+}
import { Callout } from 'fumadocs-ui/components/callout';
import { Step, Steps } from 'fumadocs-ui/components/steps';
import { Card, Cards } from 'fumadocs-ui/components/card';