Data Presentation

Accordion

A vertically stacked set of interactive headings that reveal associated content sections when clicked. Each section can be expanded or collapsed independently.

FAccordion(
  children: const [
    FAccordionItem(
      title: Text('Production Information'),
      child: Text('''
Our flagship product combines cutting-edge technology with sleek design. Built with premium materials, it offers unparalleled performance and reliability.

Key features include advanced processing capabilities, and an intuitive user interface designed for both beginners and experts.
'''),
    ),
    FAccordionItem(
      initiallyExpanded: true,
      title: Text('Shipping Details'),
      child: Text('''
We offer worldwide shipping through trusted courier partners. Standard delivery takes 3-5 business days, while express shipping ensures delivery within 1-2 business days.

All orders are carefully packaged and fully insured. Track your shipment in real-time through our dedicated tracking portal.
'''),
    ),
    FAccordionItem(
      title: Text('Return Policy'),
      child: Text('''
We stand behind our products with a comprehensive 30-day return policy. If you're not completely satisfied, simply return the item in its original condition.

Our hassle-free return process includes free return shipping and full refunds processed within 48 hours of receiving the returned item.
'''),
    ),
  ],
);

CLI

To generate and customize this style:

dart run forui style create accordion

Usage

FAccordion(...)

FAccordion(
  control: FAccordionControl.managed(
    controller: FAccordionController(min: 1, max: 2),
    onChange: (expanded) {},
  ),
  style: (style) => style.copyWith(...),
  children: [
    FAccordionItem(
      title: const Text('Is it accessible?'),
      child: const Text('Yes. It follows WAI-ARIA design patterns.'),
    ),
  ],
);

FAccordionItem(...)

FAccordionItem(
  title: const Text('Title'),
  child: const Text('Content'),
  style: FAccordionStyle(...),
  icon: const Icon(FIcons.chevronDown),
  initiallyExpanded: true,
  autofocus: false,
  focusNode: FocusNode(),
  onFocusChange: (focused) {},
  onHoverChange: (hovered) {},
  onStateChange: (states) {},
);

Examples

With Max Number of Expanded Items

FAccordion(
  control: FAccordionControl.managed(max: 2),
  children: const [
    FAccordionItem(
      title: Text('Production Information'),
      child: Text('''
Our flagship product combines cutting-edge technology with sleek design. Built with premium materials, it offers unparalleled performance and reliability.

Key features include advanced processing capabilities, and an intuitive user interface designed for both beginners and experts.
'''),
    ),
    FAccordionItem(
      initiallyExpanded: true,
      title: Text('Shipping Details'),
      child: Text('''
We offer worldwide shipping through trusted courier partners. Standard delivery takes 3-5 business days, while express shipping ensures delivery within 1-2 business days.

All orders are carefully packaged and fully insured. Track your shipment in real-time through our dedicated tracking portal.
'''),
    ),
    FAccordionItem(
      title: Text('Return Policy'),
      child: Text('''
We stand behind our products with a comprehensive 30-day return policy. If you're not completely satisfied, simply return the item in its original condition.

Our hassle-free return process includes free return shipping and full refunds processed within 48 hours of receiving the returned item.
'''),
    ),
  ],
);

On this page