Skip to content

Conversation

@rebeccaalpert
Copy link
Member

@rebeccaalpert rebeccaalpert commented Oct 13, 2025

Allow for custom icons and disabled icons.

What: Closes #12029

Additional issues:

@patternfly-build
Copy link
Contributor

patternfly-build commented Oct 13, 2025

Allow for custom icons and disabled icons.
@rebeccaalpert rebeccaalpert marked this pull request as ready for review October 13, 2025 21:17
Comment on lines +61 to +62
/** Whether to show a toggle icon when variant is not truncated. */
hasToggleIcon?: boolean;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not 100% about allowing the icon to totally be removed since it kinda removes the indication that you can click to expand/collapse something as well as its current state. If the toggle text updates based on the state + the text indicates somehow that it expands/collapses something, then less of an issue probably.

Maybe if we just have the prop description mention that if an icon is omitted, we recommend the toggle text to indicate the current state of the expandable section. Should we also get design sign off on this?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is sort of what I'm thinking could be an issue:

Uncontrolled expandable section without an icon, showing expanded state

I know this is expanded because I clicked it to expand it + knew it started as collapsed, but in other contexts it may not be clear that that is the case.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can add an error? My concern is that the consumer asked for a way for consumers to provide their own custom icon directly as part of the toggle content.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think allowing a custom icon would be fine - I assume whatever icon they pass in would retain the transition between expanded and collapsed at least. I'd be more wary about allowing the removal of the icon entirely is all.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Got it - let me bug them and see if they can get by with the smaller change.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we do want to allow removing the icon, then we need to just make sure we tell consumers that it's up to them to ensure the current state of the ExpandableSection is conveyed, most likely by having dynamic toggle text. Idk if it's always going to be clear whether content that follows the toggle is part of the expandable section or not.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1 to updating the prop description to note the additional details a user would need to convey the expanded/collapsed state.

I'm also fine with keeping the custom icon and removing the toggle. The benefit of keeping the toggle would be if a user wanted to customize where in the toggle the icon would go (passing it as a child), but we could also have an icon alignment start/end prop instead.

@rebeccaalpert rebeccaalpert requested review from a team, dlabaj and kmcfaul and removed request for a team October 14, 2025 13:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ExpandableSection / ExpandableSectionToggle - allow opting out of default icon

4 participants