Skip to content
Page PageLinks

PageLinks

A titled list of links that marks the current page with aria-current.

On this page

Examples

Resources and account

The navigation is named by its title; a link opening a new tab says so to screen readers.

Razor
<div class="grid w-full gap-8 sm:grid-cols-2">
    <KlyPageLinks Title="Resources" Links="_resources" />
    <KlyPageLinks Title="Account" Links="_account" />
</div>

@code {
    private readonly PageLinkItem[] _resources =
    [
        new("Overview", "/docs/installation") { Icon = "home", Active = true },
        new("Components", "/components/button") { Icon = "list", Active = false },
        new("Source code", "https://github.com/") { Icon = "code", Active = false, Target = KlyLinkTarget.Blank },
    ];

    private readonly PageLinkItem[] _account =
    [
        new("Profile", "/docs/installation") { Icon = "user", Active = false },
        new("Billing", "/docs/installation") { Icon = "mail", Active = false, Disabled = true },
    ];
}

API

Titled list of links, as a navigation landmark.

Parameters

Name Type Description
Class string Classes added to the root element, merged last so they win over the theme.
HeadingLevel int? Renders the title as a heading of this level (1 to 6) instead of a paragraph.
Links IReadOnlyList<PageLinkItem> The links. A link to the current page (or to a page above it, unless Exact ) is marked active.
Title string Heading above the list; it also names the navigation.
Ui PageLinksUi Per-instance class overrides of the slots of the page links, see PageLinksUi . They are merged after the theme and the Class parameter wins on the root slot.

Ui slots

Ui takes a PageLinksUi with one class string per slot, merged after the theme.

Slot Styles
Root Classes merged into the root slot of KlyPageLinks , after the theme and the app configuration.
Title Classes merged into the title slot of KlyPageLinks , after the theme and the app configuration.
List Classes merged into the list slot of KlyPageLinks , after the theme and the app configuration.
Item Classes merged into the item slot of KlyPageLinks , after the theme and the app configuration.
Link Classes merged into the link slot of KlyPageLinks , after the theme and the app configuration.
Icon Classes merged into the icon slot of KlyPageLinks , after the theme and the app configuration.
Label Classes merged into the label slot of KlyPageLinks , after the theme and the app configuration.
ExternalIcon Classes merged into the externalIcon slot of KlyPageLinks , after the theme and the app configuration.

PageLinkItem

A link of the page family. KlyPageHeader , KlyPageHero , KlyPageSection and KlyPageCta render it as a button ( Color and Variant apply); KlyPageLinks and KlyPageAnchors render it as a text link.

Parameters

Name Type Description
Active bool? Forces the active state of a text link; otherwise it follows the current address.
Color KlyColor? Defaults to Color , or primary. Values: primary, secondary, success, info, warning, error, neutral.
Disabled bool Disables the link.
Exact bool Requires the whole path to match for a text link to be active.
Href string Address the link points to.
Icon string Name of a built-in icon (see KlyIcon ) shown before the label.
Label string Text of the link.
Target KlyLinkTarget? The target attribute of the link, such as Blank .
TrailingIcon string Name of a built-in icon shown after the label (buttons only).
Variant ButtonVariant Look of the button when the link is rendered as one. Values: Solid, Outline, Soft, Subtle, Ghost, Link.