Conditional Tabs #1111
-
hi there, i tried to conditional render a tab. disabling the tab works great, i have an if statement around the tab. but when the tab gets added again by the if statement, i get an error that an item with this key was already added. am i doing this wrong? thanks for your time |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 8 replies
-
We need to see some source to be able to determine if you're doing it wrong :) There is an example in the demo that shows how to dynamically add/remove tabs that might help you: https://www.fluentui-blazor.net/Tabs#dynamic |
Beta Was this translation helpful? Give feedback.
-
Hi everyone, I have a similar issue, but my I tried to simplify my code to illustrate the problem, and I came up with this code snippet.
I would greatly appreciate it if someone could take the time to investigate the issue I am facing and provide me with some guidance on how to prevent it. I am using Microsoft.FluentUI.AspNetCore.Components v 4.5.0 Thanks in advance |
Beta Was this translation helpful? Give feedback.
This seems to come from the web component used by
FluentTabs
, which keeps an internal reference to the ID used (even if the HTML code is no longer present).The best thing would be to remove this
Id="tab-2"
attribute, if that's possible for you. In this case, the component itself generates a random and unique ID.