protected override void BuildRenderTree(RenderTreeBuilder builder) { builder .OpenElement(Type.ToButtonTagName()) .Id(ElementId) .Type(Type.ToButtonTypeString()) .Class(ClassNames) .Style(StyleNames) .Disabled(Disabled) .AriaPressed(Active) .TabIndex(TabIndex); if (Type == ButtonType.Link) { builder .Role("button") .Href(To) .Target(Target); if (Disabled) { builder .TabIndex(-1) .AriaDisabled("true"); } } if (ParentCollapseHeader?.ParentCollapse != null) { builder.AriaExpanded(ParentCollapseHeader.ParentCollapse.Visible.ToString().ToLowerInvariant()); } builder.OnClick(this, EventCallback.Factory.Create(this, ClickHandler)); builder.OnClickPreventDefault(Type == ButtonType.Link && To != null && To.StartsWith("#")); builder.Attributes(Attributes); builder.ElementReferenceCapture(capturedRef => ElementRef = capturedRef); if (Loading && LoadingTemplate != null) { builder.Content(LoadingTemplate); } else { builder.Content(ChildContent); } builder.CloseElement(); }