Skip to content
Page PageCard

PageCard

A card with an icon, a title and a description, in four variants, optionally one link over the whole card.

On this page

Examples

Variants

The spotlight glow is CSS only and off under prefers-reduced-motion.

Outline card

Hover the spotlight card to see its glow.

Soft card

Hover the spotlight card to see its glow.

Subtle card

Hover the spotlight card to see its glow.

Spotlight card

Hover the spotlight card to see its glow.

Razor
<div class="grid w-full gap-4 sm:grid-cols-2">
    @foreach (var variant in Enum.GetValues<PageCardVariant>())
    {
        <KlyPageCard Variant="variant" Icon="star" Title="@($"{variant} card")"
                    Description="Hover the spotlight card to see its glow." />
    }
</div>

The title is the only link; clicking anywhere on the card follows it. Interactive content inside the card needs relative z-10 to stay clickable.

Documentation

Install the package and render your first component.

Source code(opens in a new tab)

Read the code and open an issue.

Release notes

What changed since the last version.

Updated today
Razor
@* The title is the only link; it stretches over the card, so a click anywhere follows it: header and footer included. *@
<div class="grid w-full gap-4 sm:grid-cols-2">
    <KlyPageCard Variant="PageCardVariant.Spotlight" Icon="file" Title="Documentation" Href="/docs/installation"
                Description="Install the package and render your first component." data-testid="card-link" />
    <KlyPageCard Variant="PageCardVariant.Outline" Icon="external-link" Title="Source code" Href="https://github.com/" Target="KlyLinkTarget.Blank"
                Description="Read the code and open an issue." Color="KlyColor.Neutral" data-testid="card-external" />
    <KlyPageCard Title="Release notes" Href="/docs/installation" Description="What changed since the last version." data-testid="card-whole">
        <Header>
            <div class="h-24 bg-(--klyroo-bg-elevated)" data-testid="card-header"></div>
        </Header>
        <Footer>
            <div data-testid="card-footer-text" class="text-sm text-(--klyroo-text-muted)">Updated today</div>
            <KlyButton Label="Share" Size="KlySize.Sm" Variant="ButtonVariant.Outline" Color="KlyColor.Neutral" />
        </Footer>
    </KlyPageCard>
</div>

API

KlyPageCard

Card of a page, with a title, a description, an optional link that covers the whole card, and a spotlight effect.

Parameters

Name Type Default Description
Class string Classes added to the root element, merged last so they win over the theme.
Color KlyColor "primary" Tints the icon, the spotlight and the hover ring. Values: primary, secondary, success, info, warning, error, neutral.
Description string Secondary text of the page card, shown under or next to its title.
HeadingLevel int? 3 Level of the title heading, 1 to 6; null renders a paragraph.
Href string Makes the whole card a link, carried by the title.
Icon string Name of a built-in icon (see KlyIcon ).
Orientation KlyOrientation KlyOrientation.Vertical Horizontal puts the text and the content side by side from the lg breakpoint. Values: Horizontal, Vertical.
Reverse bool false Shows the content before the text in a horizontal card.
Target KlyLinkTarget? The target attribute of the link of the card, such as Blank . It applies when Href is set.
Title string Title of the page card.
Ui PageCardUi Per-instance class overrides of the slots of the page card, see PageCardUi . They are merged after the theme and the Class parameter wins on the root slot.
Variant PageCardVariant PageCardVariant.Outline Look of the card: Outline , Soft or Subtle . Values: Outline, Soft, Subtle, Spotlight.

Slots

Name Type Description
Footer RenderFragment Content at the bottom of the card.
Header RenderFragment Content above the text, an image for example.
ChildContent RenderFragment Content beside (horizontal) or under (vertical) the text. Interactive content would sit under the stretched link: give it relative z-10 .

Ui slots

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

Slot Styles
Root Classes merged into the root slot of KlyPageCard , after the theme and the app configuration.
Spotlight Classes merged into the spotlight slot of KlyPageCard , after the theme and the app configuration.
Header Classes merged into the header slot of KlyPageCard , after the theme and the app configuration.
Container Classes merged into the container slot of KlyPageCard , after the theme and the app configuration.
Wrapper Classes merged into the wrapper slot of KlyPageCard , after the theme and the app configuration.
Body Classes merged into the body slot of KlyPageCard , after the theme and the app configuration.
Leading Classes merged into the leading slot of KlyPageCard , after the theme and the app configuration.
LeadingIcon Classes merged into the leadingIcon slot of KlyPageCard , after the theme and the app configuration.
Title Classes merged into the title slot of KlyPageCard , after the theme and the app configuration.
Description Classes merged into the description slot of KlyPageCard , after the theme and the app configuration.
Footer Classes merged into the footer slot of KlyPageCard , after the theme and the app configuration.
Link Classes merged into the link slot of KlyPageCard , after the theme and the app configuration.