Use this file to discover all available pages before exploring further.
The Accordion component provides an interactive way to show and hide content. It supports nested accordions, icons, URL state management, and can be grouped for a unified appearance.
<Accordion title="What is Mintlify?" defaultOpen={false}> <p> Mintlify is a platform for creating beautiful documentation for your products. </p></Accordion>
The title displayed in the accordion header. Prefer using a string value for better compatibility with URL state synchronization and tracking callbacks.
<Accordion title="Installation" description="Learn how to install Mintlify" defaultOpen={false}> <p>Run the following command to install Mintlify:</p> <pre>npm install -g mintlify</pre></Accordion>
<Accordion title="API Reference" icon="code" iconType="solid" defaultOpen={false}> <p>View the complete API reference for all available endpoints.</p></Accordion>
<Accordion title="Accordion with Callbacks" description="This accordion logs when opened or closed" defaultOpen={false} trackOpen={(event) => console.log("Accordion opened:", event)} trackClose={(event) => console.log("Accordion closed:", event)} onMount={() => console.log("Accordion mounted")}> <p>Check the browser console to see the logs.</p></Accordion>
import { Accordion, getInitialOpenState, updateAndCopyUrl } from '@mintlify/components';function MyComponent() { const getInitialOpen = getInitialOpenState(); const handleUrlChange = updateAndCopyUrl(); return ( <> <Accordion title="URL Synced Accordion 1" description="This accordion state is reflected in the URL" defaultOpen={false} getInitialOpenFromUrl={getInitialOpen} onUrlStateChange={handleUrlChange} > <p>When you open this accordion, the URL hash will update to include its ID.</p> <p>Try refreshing the page - the accordion will maintain its state!</p> </Accordion> <Accordion title="URL Synced Accordion 2" description="This one also syncs with the URL" defaultOpen={false} getInitialOpenFromUrl={getInitialOpen} onUrlStateChange={handleUrlChange} > <p>Each accordion has its own unique ID in the URL.</p> </Accordion> </> );}
The URL state management feature automatically copies the URL to the clipboard when an accordion is opened, making it easy to share direct links to specific sections.
<Accordion.Group> <Accordion title="First Accordion" defaultOpen={true}> <p>Content of the first accordion.</p> </Accordion> <Accordion title="Second Accordion" defaultOpen={false}> <p>Content of the second accordion.</p> </Accordion> <Accordion title="Third Accordion" defaultOpen={false}> <p>Content of the third accordion.</p> </Accordion></Accordion.Group>