Conditional Tabs #1840
Replies: 7 comments 2 replies
-
Here's a screenshot of the current behavior of the field without handling of edge cases |
Beta Was this translation helpful? Give feedback.
-
This would be helpful for me too, as I currently use tabs to realize a table component. I have a max of 10 columns and each tab represents a column. Now all of these are always visible, with a condition I could add a "numberOfColumns" select, that let's the user decide how many columns they need to make it clearer. To my understanding this is currently not possible |
Beta Was this translation helpful? Give feedback.
-
I was looking through discussion to check if someone is having this exact feature request. I think this would be a great addon |
Beta Was this translation helpful? Give feedback.
-
There is another discussion around hiding tabs where the user has no I think this should be considered part of this roadmap item. |
Beta Was this translation helpful? Give feedback.
-
+1 for this feature as well. It would be great if tabs responded to admin conditions. For example... admin: {
condition: (_, siblingData) =>
['sidebarSecond', 'sidebarBoth'].includes(siblingData.layout)
}, |
Beta Was this translation helpful? Give feedback.
-
I've also got a use case for this; when developing layout components I want to show a tab with |
Beta Was this translation helpful? Give feedback.
-
This didn't quite make it into v3. This PR is very close to being done #8720. |
Beta Was this translation helpful? Give feedback.
-
Issue
The ability to conditionally display tabs in a tab component would be incredibly helpful for certain implementations and provide for much cleaner and more concise code. In my implementation I have a role based user system that organizes user data into tabs to improve the readability of the data for end users. There are multiple tabs that are used across multiple user roles necessitating the use of multiple tab fields with conditional logic on each field. This works for 90% of users, however, if users have multiple roles things get convoluted when writing the conditional statements in order to prevent multiple tab rows from being displayed.
Below is a simple implementation of the tabs, with only two roles for brevity.
Proposed Change
In a role system where users can have multiple roles, a user with both the customer and employee roles will have two tab rows displayed with duplicated tabs in each unless a third tab field is created to cover the edge case where both roles are present. This only gets more complicated with each role added to the available user roles. Ideally, the tab field would accept conditional statements for each tab, consolidating the multitude of edge cases that require their own field into a single field as shown below:
Closing Thoughts
This is only an example of a single use case, but it can be used in E-commerce implementations for products based on product types, blogs based on post categories, etc. This wouldn't affect the structure of the data, simply improve the way the data would be displayed in the browser.
Beta Was this translation helpful? Give feedback.
All reactions