-
Notifications
You must be signed in to change notification settings - Fork 373
Description
Is this a new component or an extension of an existing one?
Extension of ExpandableSection#toggleContent.
Describe the feature
It’s great that ExpandableSection supports a detached mode for advanced customization, but in many cases, using the detached setup feels like overkill, especially when the only requirement is to slightly adjust the toggleContent based on the expanded state.
Introducing support for a functional form of toggleContent (e.g., a function that receives isExpanded) would provide a simpler, more flexible API for customizing toggle content without having to fully detach the section logic.
<ExpandableSection
toggleContent={(isExpanded) =>
isExpanded ? <ExpandedToggleContent /> : <CollapsedToggleContent />
}
/>Are there visuals for this feature? If applicable, please include examples for each state and for varying widths
No
Any other information?
Alternatively, to align with the existing toggleText API, the component could support separate props like toggleContentExpanded and toggleContentCollapsed.
Either approach would make ExpandableSection more flexible and ergonomic for common UI scenarios.
Metadata
Metadata
Assignees
Labels
Type
Projects
Status