Skip to content

Conversation

@Nidoxs
Copy link
Contributor

@Nidoxs Nidoxs commented Jan 14, 2025

While working on a plugin I needed a tab within a TabContainer to change its text dynamically based on some state. This is not easy to do at the moment with TabContainer and would involve juggling key names and making sure the currently selected tab state is updated to match the new key name whenever your tab would depend on some state to define its display text.

I've added a DisplayTitle prop to the TabContainer children tabs which will be checked for before resorting to using the child key as the display title. No changes have been made to the key being used as the identifer that is passed to OnTabSelected.

  • add entry to the changelog

Comment on lines 39 to 40
For situations where the tab's display title may change depending on some state, you
can use the `DisplayTitle` prop within each `TabContainer` child:
Copy link
Owner

Choose a reason for hiding this comment

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

Suggested change
For situations where the tab's display title may change depending on some state, you
can use the `DisplayTitle` prop within each `TabContainer` child:
To override the text displayed on a tab, assign a value to the optional
`DisplayTitle` field in the tab entry; see the "Comments" example below:

Co-authored-by: sircfenner <sircfenner@users.noreply.github.com>
@sircfenner sircfenner merged commit ceb9d45 into sircfenner:main Jan 15, 2025
1 check passed
@sircfenner
Copy link
Owner

Thank you!

@Nidoxs Nidoxs deleted the tab-container-display-titles branch January 15, 2025 00:58
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.

2 participants