Skip to content
Page PageHero

PageHero

A landing hero with a headline, a title, a description, links and an optional media slot.

On this page

Examples

With media

The media sits beside the text from the lg breakpoint; Reverse puts it first.

Open source

Ship forms faster

Accessible form controls that validate in the browser and on the server, in every render mode.

$ dotnet add package Klyroo.UI

$ dotnet run

Razor
<div class="w-full overflow-hidden rounded-lg border border-(--klyroo-border) bg-(--klyroo-bg)">
    <KlyPageHero Headline="Open source" Title="Ship forms faster" HeadingLevel="3"
                Description="Accessible form controls that validate in the browser and on the server, in every render mode."
                Links="_links" Ui="_ui">
        <Media>
            <div class="rounded-xl border border-(--klyroo-border) bg-(--klyroo-bg-elevated) p-5 font-mono text-sm text-(--klyroo-text)">
                <p><span class="text-(--klyroo-text-muted)">$</span> dotnet add package Klyroo.UI</p>
                <p><span class="text-(--klyroo-text-muted)">$</span> dotnet run</p>
            </div>
        </Media>
    </KlyPageHero>
</div>

@code {
    private readonly PageHeroUi _ui = new()
    {
        Container = "py-12 sm:py-12 lg:py-12",
        Title = "text-4xl sm:text-4xl lg:text-5xl",
    };

    private readonly PageLinkItem[] _links =
    [
        new("Get started", "/docs/installation") { TrailingIcon = "arrow-right" },
        new("View the source", "https://github.com/") { Target = KlyLinkTarget.Blank, Color = KlyColor.Neutral, Variant = ButtonVariant.Outline },
    ];
}

Vertical

One stylesheet, every render mode

Server, WebAssembly, Auto and static pages share the same markup and the same theme.

Razor
<div class="w-full overflow-hidden rounded-lg border border-(--klyroo-border) bg-(--klyroo-bg)">
    <KlyPageHero Orientation="KlyOrientation.Vertical" Title="One stylesheet, every render mode" HeadingLevel="3"
                Description="Server, WebAssembly, Auto and static pages share the same markup and the same theme."
                Links="_links" Ui="_ui" />
</div>

@code {
    private readonly PageHeroUi _ui = new()
    {
        Container = "py-12 sm:py-12 lg:py-12",
        Title = "text-4xl sm:text-4xl lg:text-5xl",
    };

    private readonly PageLinkItem[] _links =
    [
        new("Get started", "/docs/installation"),
        new("Browse components", "/components/button") { Color = KlyColor.Neutral, Variant = ButtonVariant.Subtle },
    ];
}

API

KlyPageHero

Hero section of a landing page, with a headline, a title, a description, links and an optional media area.

Parameters

Name Type Default Description
Class string Classes added to the root element, merged last so they win over the theme.
Description string Secondary text of the page hero, shown under or next to its title.
HeadingLevel int 1 Level of the title heading, 1 to 6: 1 by default, the main heading of the page. A page has one h1: when a KlyPageHeader and a KlyPageHero share a page, or either sits under another h1, set this to 2 on the secondary one.
Headline string Short text above the title, such as an announcement or a category.
Links IReadOnlyList<PageLinkItem> Links rendered as buttons under the description.
Orientation KlyOrientation KlyOrientation.Horizontal Horizontal puts the text and the media side by side; vertical centers the text above the media. Values: Horizontal, Vertical.
Reverse bool false Shows the media before the text in a horizontal hero.
Title string Title of the page hero.
Ui PageHeroUi Per-instance class overrides of the slots of the page hero, see PageHeroUi . They are merged after the theme and the Class parameter wins on the root slot.

Slots

Name Type Description
Media RenderFragment An illustration, a screenshot or a demo shown beside (horizontal) or under (vertical) the text.
ChildContent RenderFragment Extra content under the links.

Ui slots

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

Slot Styles
Root Classes merged into the root slot of KlyPageHero , after the theme and the app configuration.
Container Classes merged into the container slot of KlyPageHero , after the theme and the app configuration.
Wrapper Classes merged into the wrapper slot of KlyPageHero , after the theme and the app configuration.
Headline Classes merged into the headline slot of KlyPageHero , after the theme and the app configuration.
Title Classes merged into the title slot of KlyPageHero , after the theme and the app configuration.
Description Classes merged into the description slot of KlyPageHero , after the theme and the app configuration.
Links Classes merged into the links slot of KlyPageHero , after the theme and the app configuration.
Media Classes merged into the media slot of KlyPageHero , after the theme and the app configuration.