# dropdown

URL: /patitas/api/directives/builtins/dropdown/
Section: builtins
Description: Dropdown directive for collapsible content.

Provides collapsible sections with markdown support including
nested directives and code blocks.

Options:
:open: Start expanded (default: false)
:icon: Icon name to display next to the title
:badge: Badge text (e.g., "New", "Advanced", "Beta")
:color: Color variant (success, warning, danger, info, minimal)
:description: Secondary text below the title
:class: Additional CSS classes

Example:
:::{dropdown} Click to expand
:open:
:icon: info
:badge: New
:color: info
:description: Additional context about this content

Hidden content here with **markdown** support.
:::

Thread Safety:
Stateless handler. Safe for concurrent use across threads.

---

> For a complete page index, fetch /patitas/llms.txt.

Open LLM text
(/patitas/api/directives/builtins/dropdown/index.txt)

Share with AI

Ask Claude
(https://claude.ai/new?q=Please%20help%20me%20understand%20this%20documentation%3A%20%2Fpatitas%2Fapi%2Fdirectives%2Fbuiltins%2Fdropdown%2Findex.txt)

Ask ChatGPT
(https://chatgpt.com/?q=Please%20help%20me%20understand%20this%20documentation%3A%20%2Fpatitas%2Fapi%2Fdirectives%2Fbuiltins%2Fdropdown%2Findex.txt)

Ask Gemini
(https://gemini.google.com/app?q=Please%20help%20me%20understand%20this%20documentation%3A%20%2Fpatitas%2Fapi%2Fdirectives%2Fbuiltins%2Fdropdown%2Findex.txt)

Ask Copilot
(https://copilot.microsoft.com/?q=Please%20help%20me%20understand%20this%20documentation%3A%20%2Fpatitas%2Fapi%2Fdirectives%2Fbuiltins%2Fdropdown%2Findex.txt)

Module

#
`directives.builtins.dropdown`

Dropdown directive for collapsible content.

Provides collapsible sections with markdown support including
nested directives and code blocks.

Options:

:open: Start expanded (default: false)
:icon: Icon name to display next to the title
:badge: Badge text (e.g., "New", "Advanced", "Beta")
:color: Color variant (success, warning, danger, info, minimal)
:description: Secondary text below the title
:class: Additional CSS classes

Example:

Click to expandAdditional context about this contentNew

Hidden content here with markdown support.

Thread Safety:

Stateless handler. Safe for concurrent use across threads.

2Classes1Function

## Classes

`DropdownOptions`

5

▼

Options for dropdown directive.

Bases:

`StyledOptions (/patitas/api/directives/options/#StyledOptions)`

Options for dropdown directive.

#### Attributes

Name
Type
Description

`open`

`bool`

Whether dropdown is initially open (expanded)

`icon`

`str | None`

Icon name to display next to the title

`badge`

`str | None`

Badge text (e.g., "New", "Advanced", "Beta")

`color`

`str | None`

Color variant (success, warning, danger, info, minimal)

`description`

`str | None`

Secondary text below the title

`DropdownDirective`

7

▼

Handler for dropdown (collapsible) directive.

Renders collapsible content using <details>/<summary…

Handler for dropdown (collapsible) directive.

Renders collapsible content using /.

Thread Safety:

```
Stateless handler. Safe for concurrent use.
```

#### Attributes

Name
Type
Description

`names`

`ClassVar[tuple[str, ...]]`

—

`token_type`

`ClassVar[str]`

—

`contract`

`ClassVar[DirectiveContract (/patitas/api/directives/contracts/#DirectiveContract) | None]`

—

`options_class`

`ClassVar[type[DropdownOptions (/patitas/api/directives/builtins/dropdown/#DropdownOptions)]]`

—

`preserves_raw_content`

`ClassVar[bool]`

—

#### Methods

`parse`

6

`Directive (/patitas/api/nodes/#Directive)[DropdownOption…`

▼

Build dropdown AST node.

`def parse(self, name: str, title: str | None, options: DropdownOptions, content: str, children: Sequence[Block], location: SourceLocation) -> Directive[DropdownOptions]`

##### Parameters

Name
Type
Description

`name`
`—`

`title`
`—`

`options`
`—`

`content`
`—`

`children`
`—`

`location`
`—`

##### Returns

`Directive (/patitas/api/nodes/#Directive)[DropdownOptions (/patitas/api/directives/builtins/dropdown/#DropdownOptions)]`

`render`

3

▼

Render dropdown to HTML.

`def render(self, node: Directive[DropdownOptions], rendered_children: str, sb: StringBuilder) -> None`

##### Parameters

Name
Type
Description

`node`
`—`

Directive AST node

`rendered_children`
`—`

Pre-rendered child content

`sb`
`—`

StringBuilder for output

## Functions

`_render_dropdown_icon`

1

`str`

▼

Render dropdown icon using icon resolver.

`def _render_dropdown_icon(icon_name: str) -> str`

##### Parameters

Name
Type
Description

`icon_name`
`str`

Name of the icon to render

##### Returns

`str`
