Description
BreadcrumbsItem can have a prefix component (for example an icon) set with
setPrefixComponent. It also has setText to change the item's text. If you call setText after a prefix has been set, the prefix is removed as setText replaces all content of the item.
This is different from Button and Badge, which have custom implementations that preserve content in other slots when calling setText. SideNavItem does not use HasText, but has a custom setLabel method.
Expected outcome
Setting the text should only change the text. The prefix component should stay.
Minimal reproducible example
BreadcrumbsItem item = new BreadcrumbsItem("Inbox (2 items)");
item.setPrefixComponent(new Icon(VaadinIcon.ENVELOPE));
item.setText("Inbox (3 items)");
Description
BreadcrumbsItemcan have a prefix component (for example an icon) set withsetPrefixComponent. It also hassetTextto change the item's text. If you callsetTextafter a prefix has been set, the prefix is removed assetTextreplaces all content of the item.This is different from
ButtonandBadge, which have custom implementations that preserve content in other slots when callingsetText.SideNavItemdoes not useHasText, but has a customsetLabelmethod.Expected outcome
Setting the text should only change the text. The prefix component should stay.
Minimal reproducible example