Navigation
Accordion
Collapsible content sections.
Available in
reactangularPreview
Live previewreal component
mcp-elements speaks both stdio and streamable HTTP. The client negotiates the transport during the initialize handshake.
OAuth 2.1 with PKCE is supported out of the box. Tokens are scoped per-server and refreshed automatically.
Tools are listed via tools/list and invoked with tools/call. Schemas are validated against the advertised JSON Schema.
Install
TerminalBash
npx mcp-elements add accordionUsage
accordion-example.tsxTSX
import { Accordion, AccordionItem, AccordionTrigger, AccordionContent } from '@mcp-elements/react'
const items = [
{ value: 'transport' },
{ value: 'auth' },
{ value: 'tools' },
]
export function Example() {
return (
<Accordion items={items} collapsible className="w-full max-w-md">
{({ expandedValues, getTriggerProps, getContentProps }) => (
<>
{items.map((item) => (
<AccordionItem key={item.value}>
<AccordionTrigger
{...getTriggerProps(item.value, expandedValues)}
isExpanded={expandedValues.includes(item.value)}
>
{item.value}
</AccordionTrigger>
<AccordionContent {...getContentProps(item.value, expandedValues)}>
Configuration details for {item.value}.
</AccordionContent>
</AccordionItem>
))}
</>
)}
</Accordion>
)
}Props
| Prop | Type | Default | Description |
|---|---|---|---|
items * | AccordionItemConfig[] | — | Item configs, each with a unique `value` and optional `disabled` flag |
type | 'single' | 'multiple' | 'single' | Whether one or multiple items can be expanded at once |
collapsible | boolean | false | In single mode, allow collapsing the open item by clicking it again |
children * | (api: ReturnType<typeof useAccordion>) => React.ReactNode | — | Render prop receiving the accordion API (expandedValues, getTriggerProps, getContentProps, etc.) |
className | string | — | Additional CSS classes for the wrapper |