ContentNavigation
The navigation of a documentation site: a tree of pages with collapsible groups, icons and badges.
On this page
Examples
Nested groups
Groups open and close in the browser. The current page is marked with aria-current="page" from the address; this site's sidebar is a ContentNavigation.
Razor
@* The sidebar of this site is a ContentNavigation too. The current page is compared with each Href (aria-current="page");
here Active is forced so the example does not depend on the address of the docs page that hosts it. *@
<div class="w-72 rounded-xl border border-(--klyroo-border) p-3" data-testid="content-navigation-example">
<KlyContentNavigation Items="_items" AriaLabel="Example documentation" />
</div>
@code {
private static readonly KlyContentNavigationItem[] _items =
[
new("Getting started")
{
Icon = "book-open",
Open = true,
Children =
[
new("Introduction") { Href = "#introduction", Active = true },
new("Installation") { Href = "#installation", Active = false },
new("Theming") { Href = "#theming", Active = false, Badge = "New", BadgeColor = KlyColor.Success },
],
},
new("Components")
{
Icon = "folder",
Open = false,
Children =
[
new("Elements")
{
Open = true,
Children =
[
new("Button") { Href = "#button", Active = false },
new("Badge") { Href = "#badge", Active = false },
],
},
new("Form")
{
Children =
[
new("Input") { Href = "#input", Active = false },
new("Select") { Href = "#select", Active = false },
],
},
new("Archived") { Href = "#archived", Disabled = true },
],
},
new("Changelog") { Icon = "file", Href = "#changelog", Active = false },
];
}API
KlyContentNavigation
Navigation tree of a documentation site, with collapsible groups and the current page highlighted.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
AriaLabel |
string |
Accessible name of the navigation landmark. Needed when the page has several. | |
Class |
string |
Classes added to the root element, merged last so they win over the theme. | |
Color |
KlyColor |
"primary" |
The color of the mark on the current page. Values: primary, secondary, success, info, warning, error, neutral. |
Items (required) |
IReadOnlyList |
The entries. A top-level entry with children is a section heading with its pages below it. | |
Ui |
Content |
Per-instance class overrides of the slots of the content navigation, see ContentNavigationUi . They are merged after the theme and the Class parameter wins on the root slot. |
Ui slots
Ui takes a Content with one class string per slot, merged after the theme.
| Slot | Styles |
|---|---|
Root |
Classes merged into the root slot of KlyContentNavigation , after the theme and the app configuration. |
List |
Classes merged into the list slot of KlyContentNavigation , after the theme and the app configuration. |
Item |
Classes merged into the item slot of KlyContentNavigation , after the theme and the app configuration. |
Link |
Classes merged into the link slot of KlyContentNavigation , after the theme and the app configuration. |
Trigger |
Classes merged into the trigger slot of KlyContentNavigation , after the theme and the app configuration. |
Section |
Classes merged into the section slot of KlyContentNavigation , after the theme and the app configuration. |
SectionList |
Classes merged into the sectionList slot of KlyContentNavigation , after the theme and the app configuration. |
Icon |
Classes merged into the icon slot of KlyContentNavigation , after the theme and the app configuration. |
Label |
Classes merged into the label slot of KlyContentNavigation , after the theme and the app configuration. |
Badge |
Classes merged into the badge slot of KlyContentNavigation , after the theme and the app configuration. |
Chevron |
Classes merged into the chevron slot of KlyContentNavigation , after the theme and the app configuration. |
Group |
Classes merged into the group slot of KlyContentNavigation , after the theme and the app configuration. |
GroupList |
Classes merged into the groupList slot of KlyContentNavigation , after the theme and the app configuration. |