Tinyrack

Accordion

Stack disclosure items that expand one section or several at a time.

Stack disclosure items that expand one section or several at a time.

Contract

AxisContract
SelectionControlled value or uncontrolled defaultValue
ExpansionSingle by default; set multiple for independent open items
AvailabilityDisable individual TRAccordionItem entries
LifecycleClosed content is removed from the widget tree

When value is provided, update it from onValueChange so the rendered panels follow each interaction. Tab follows the normal focus order, Enter activates immediately, and Space activates on key release. Disabled items ignore pointer and keyboard activation.

Install

Add the package, then import its public library.

flutter pub add tinyrack_ui
import 'package:tinyrack_ui/tinyrack_ui.dart';

Playground

Usage

import 'package:material_ui/material_ui.dart';
import 'package:tinyrack_ui/tinyrack_ui.dart';

TRAccordion(
  items: const [
    TRAccordionItem(
      value: 'install',
      trigger: Text('Install'),
      content: Text('Run the installer.'),
    ),
  ],
)

Examples

Controlled multiple expansion permalink

Update value from onValueChange so either section can open or close and the current selection stays visible.

Single, multiple, and disabled states permalink

Use the default single mode for mutually exclusive sections, multiple for independent sections, and disabled on an unavailable item.

API

TRAccordion properties

PropType / defaultPurpose
itemsList<TRAccordionItem> · requiredDefines the ordered disclosure items.
valueList<String>? · nullControls the open item values.
defaultValueList<String> · const []Sets the initially open values in uncontrolled mode.
multiplebool · falseAllows several items to remain open.
onValueChangeValueChanged<List<String>>? · nullReports the next open values after activation.

TRAccordionItem properties

PropType / defaultPurpose
valueString · requiredIdentifies the item in the root value list.
triggerWidget · requiredRenders the interactive item label.
contentWidget · requiredRenders the panel while the item is open.
disabledbool · falsePrevents pointer and keyboard activation.