AccordionItem

AccordionItem is the data record for one section inside an Accordion.
It is not a standalone widget. You build one item for each section you want to show, then hand the whole list to Accordion. The important state lives outside the item: your app decides whether the section is expanded and what action should run when the header is toggled.

Example

use fission::prelude::*;

let item = AccordionItem {
    title: "Advanced filters".into(),
    content: Text::new("Extra search controls go here").into(),
    is_expanded: view.state().advanced_filters_open,
    on_toggle: Some(toggle_advanced_filters_action),
};
This keeps the item definition easy to read. The actual reducer still decides whether the section opens and closes.

Field table

Field
Type
Meaning
Notes / default behavior
title
String
Text shown in the accordion header.
Required. Keep titles short and scannable.
content
Widget
Body content shown when the item is expanded.
Required. This can be any widget subtree.
is_expanded
bool
Whether the content is currently visible.
Controlled by app state.
on_toggle
Option<ActionEnvelope>
Action fired when the header is pressed.
Defaults to None. Usually flips is_expanded in the reducer.

Specific advice

Keep content focused on one section's job. If the body becomes a whole screen or a deeply stateful workflow, it is usually clearer to move that work into a dedicated widget and use the accordion only as the disclosure shell.

Production checklist

For AccordionItem, review the fields that change behavior before treating the widget as finished: title, content, is_expanded, on_toggle. The goal is to make the product rule visible in state and actions, not hidden inside ad-hoc construction code.
Bind on_toggle to explicit reducer actions and test that the reducer handles unavailable, duplicate, or invalid input safely.
When child widgets are generated from data, give reordered or filtered rows an explicit WidgetId so retained local state and scroll behavior do not drift between items.
Check the semantics tree for the user-facing label or role that makes this widget understandable without relying only on pixels.
Add at least one component or harness test that confirms the visible text, semantic role, action dispatch, and layout constraint that matter for this widget in context.
If a screen starts repeating the same AccordionItem setup, extract a named component around this widget. That keeps the reference API small while making product code easier to read and safer for generated code to copy.
Accordion, Button, Card, and Tabs.
Fission
A cross-platform, GPU-accelerated user interface framework for Rust. MIT licensed.
Copyright (c) 2026 Fission
Ready to use today. Widget APIs are expected to remain stable; some runtime and shell APIs may change before 1.0.0.
Fission 0.7.0