Skip to content

Beautiful, AI-native markdown IDE and LLM wiki

1.9 KB
Raw Blame
---
title: "Toggle"
description: "Standalone expand/collapse block. Same render + props as `<Accordion>` under a different tag name; pick whichever name the vault already uses"
keywords: "toggle, collapsible, expand, details, disclosure, fold"
---

## Example

<ComponentPreview>
  <AccordionPreview title="Show me the details" description="Click to expand" icon="lucide:BookOpen">
    Native `<details>` under the hood — same substrate as the app render.
    Pass a shared `name` to sibling toggles and the browser will keep
    only one open at a time.
  </AccordionPreview>
</ComponentPreview>

```mdx
<Toggle title="Title">
  Body content revealed when the toggle is expanded.
</Toggle>
```

## Props

<TypeTable
  type={{
  "title": {
    description: "Heading shown inside the <summary>",
    type: "string",
    required: true,
  },
  "defaultOpen": {
    description: "When true, the block renders expanded on initial load",
    type: "boolean",
    required: false,
    default: "false",
  },
  "icon": {
    description: "Custom lucide icon override (e.g. \\`lucide:Rocket\\`)",
    type: "string",
    required: false,
  },
  "description": {
    description: "Optional subtitle rendered below the title inside <summary>",
    type: "string",
    required: false,
  },
  "id": {
    description: "HTML id attribute for deep-linking (e.g. \\`#advanced-options\\`)",
    type: "string",
    required: false,
  },
  "name": {
    description: "HTML5 <details name=> group — siblings with the same name are mutually exclusive",
    type: "string",
    required: false,
  },
}}
/>

_Also matches:_ `toggle`, `collapsible`, `expand`, `details`, `disclosure`, `fold`

## Author it

Type `/toggle` in the editor to insert it from the slash menu, or write the tag directly in source mode. The Properties panel on the right of the editor exposes every prop above as a form field once the block is selected.