Skip to content

Commit 04ddf04

Browse files
Add expand/collapse functionality to McpClient component
Long client descriptions are now truncated at ~3 lines with a gradient fade-out effect. A chevron button allows users to expand/collapse the content. Overflow detection ensures the toggle only appears when needed. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <[email protected]>
1 parent b43b7c6 commit 04ddf04

File tree

1 file changed

+30
-2
lines changed

1 file changed

+30
-2
lines changed

docs/clients.mdx

Lines changed: 30 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,17 @@ export const McpClient = ({ name, homepage, supports, sourceCode, instructions,
2727
Configuration instructions
2828
</a>;
2929

30+
const [expanded, setExpanded] = useState(false);
31+
const [hasOverflow, setHasOverflow] = useState(false);
32+
const contentRef = useRef(null);
33+
34+
useEffect(() => {
35+
const el = contentRef.current;
36+
if (el) {
37+
setHasOverflow(el.scrollHeight > el.clientHeight);
38+
}
39+
}, []);
40+
3041
return (
3142
<div id={slug} className="group mt-8 scroll-mt-32">
3243
<div className="border border-gray-200 dark:border-gray-700 rounded-lg overflow-hidden">
@@ -79,8 +90,25 @@ export const McpClient = ({ name, homepage, supports, sourceCode, instructions,
7990
</div>
8091
)}
8192
</div>
82-
<div className="px-4 py-4 prose">
83-
{children}
93+
<div className="relative">
94+
<div
95+
ref={contentRef}
96+
className={`px-4 py-4 prose ${!expanded ? 'max-h-[7rem] overflow-hidden' : 'pb-8'}`}
97+
>
98+
{children}
99+
</div>
100+
{hasOverflow && (
101+
<button
102+
onClick={() => setExpanded(!expanded)}
103+
className={`absolute bottom-0 left-0 right-0 flex justify-center items-end pb-1 cursor-pointer text-gray-400 hover:text-gray-600 ${
104+
!expanded ? 'h-16 bg-gradient-to-t from-white dark:from-gray-900 to-transparent' : 'h-8'
105+
}`}
106+
>
107+
<span className={`${expanded ? 'rotate-180' : ''} bg-white/60 dark:bg-gray-900/60 rounded-full`}>
108+
<Icon icon="chevron-down" iconType="solid" size={18} />
109+
</span>
110+
</button>
111+
)}
84112
</div>
85113
</div>
86114
</div>

0 commit comments

Comments
 (0)