Use accordion() for stacked FAQ or detail items, and expander() for a single collapsible disclosure block containing arbitrary child components.
accordion()
expander()
<ComponentPreview title="Accordion & Expander">
[
{
"type": "accordion",
"items": [
{"title": "How does token streaming work?", "content": "Handlers call aiui.stream_token() and chunks stream live over WebSocket or SSE."},
{"title": "Can I build pages without Python?", "content": "Yes — declare pages and components directly in app.yaml."}
]
},
"type": "expander",
"title": "Advanced retry policy",
"expanded": true,
"children": [
{"type": "key_value_list", "items": [{"label": "Max Retries", "value": "3"}, {"label": "Backoff", "value": "Exponential"}]}
}
</ComponentPreview>
<Tabs>
<Tab title="Python">
</Tab>
<Tab title="YAML">
</Tabs>
| Component | Parameter | Description |
|---|---|---|
| accordion | items | List of {title, content} or {title, children} sections. |
accordion
items
{title, content}
{title, children}
| expander | title, children, expanded, lazy, load | Single collapsible panel; set lazy=True or load="/api/..." to defer heavy content. |
expander
title
children
expanded
lazy
load
lazy=True
load="/api/..."