Skip to content

Commit

Permalink
Allow to specify class on NavItems
Browse files Browse the repository at this point in the history
  • Loading branch information
MarvinKlein1508 committed Sep 27, 2023
1 parent 30eb31e commit 6ba3f39
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,10 @@
new NavItem { Id = "7", Href = "/sidebar", IconName = IconName.LayoutSidebarInset, Text = "Sidebar", ParentId="4"},

new NavItem { Id = "8", IconName = IconName.WindowPlus, Text = "Forms" },
new NavItem { Id = "9", Href = "/autocomplete", IconName = IconName.InputCursorText, Text = "Auto Complete", ParentId="8"},
new NavItem { Id = "10", Href = "/currency-input", IconName = IconName.CurrencyDollar, Text = "Currency Input", ParentId="8"},
new NavItem { Id = "11", Href = "/number-input", IconName = IconName.InputCursor, Text = "Number Input", ParentId="8"},
new NavItem { Id = "12", Href = "/switch", IconName = IconName.ToggleOn, Text = "Switch", ParentId="8"},
new NavItem { Id = "9", Href = "/autocomplete", IconName = IconName.InputCursorText, Text = "Auto Complete", ParentId="8", Class="px-3"},
new NavItem { Id = "10", Href = "/currency-input", IconName = IconName.CurrencyDollar, Text = "Currency Input", ParentId="8", Class="px-3"},
new NavItem { Id = "11", Href = "/number-input", IconName = IconName.InputCursor, Text = "Number Input", ParentId="8", Class="px-3"},
new NavItem { Id = "12", Href = "/switch", IconName = IconName.ToggleOn, Text = "Switch", ParentId="8", Class="px-3"},
};

return navItems;
Expand Down
3 changes: 2 additions & 1 deletion blazorbootstrap/Components/Sidebar/SidebarItem.razor
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,8 @@
Href="@childItem.Href"
Text="@childItem.Text"
Target="@childItem.Target"
Match="@childItem.Match"/>
Match="@childItem.Match"
Class="@childItem.Class" />
}
}
</div>
3 changes: 2 additions & 1 deletion blazorbootstrap/Components/Sidebar/SidebarItemGroup.razor
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@
Target="@item.Target"
Match="@item.Match"
HasChilds="@item.HasChilds"
ChildItems="@item.ChildItems"/>
ChildItems="@item.ChildItems"
Class="@item.Class"/>
}
}
</nav>
5 changes: 5 additions & 0 deletions blazorbootstrap/Models/NavItem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,11 @@ public class NavItem
/// Gets or sets the navigation link text.
/// </summary>
public string? Text { get; set; }

/// <summary>
/// Gets or sets an additional css class for the item
/// </summary>
public string? Class { get; set; }

#endregion
}

0 comments on commit 6ba3f39

Please sign in to comment.