Skip to content
Elements Banner

Banner

An announcement bar. Its close button remembers the dismissal per Id in the browser, static pages included.

On this page

Examples

Close it and reload the page: it stays hidden.

Razor
<div class="w-full overflow-hidden rounded-(--klyroo-radius)">
    <KlyBanner Id="playground-launch" Title="Klyroo.UI 0.1 is out" Href="/docs" Icon='KlyIcons.Named("zap", "size-5")' Close data-testid="banner">
        <Actions>
            <KlyButton Label="Read more" Size="KlySize.Xs" Color="KlyColor.Neutral" />
        </Actions>
    </KlyBanner>
</div>

API

KlyBanner

Dismissible announcement bar at the top of a page. Dismissal is remembered in the browser by Id .

Parameters

Name Type Default Description
Class string Classes added to the root element, merged last so they win over the theme.
Close bool false Shows a close button. It needs the Klyroo browser module, which every render mode loads.
Color KlyColor "primary" Semantic color of the banner: a built-in KlyColor or the name of a color you defined. When not set, Color applies, else the default of the component. Values: primary, secondary, success, info, warning, error, neutral.
Description string Text of the banner.
Href string Turns the title into a link that covers the whole banner.
Id string Identifies the banner in the browser's localStorage: a dismissed banner stays hidden on later visits. Without an Id a dismissal only lasts until the page is reloaded.
Target KlyLinkTarget? The target attribute of the banner link, such as Blank . It applies when Href is set.
Title string Title of the banner.
Ui BannerUi Per-instance class overrides of the slots of the banner, see BannerUi . They are merged after the theme and the Class parameter wins on the root slot.

Slots

Name Type Description
Actions RenderFragment Buttons or links shown at the end of the banner.
Icon RenderFragment Icon of the banner, as markup such as a KlyIcon .
ChildContent RenderFragment Rich description, instead of Description .

Ui slots

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

Slot Styles
Root Classes merged into the root slot of KlyBanner , after the theme and the app configuration.
Container Classes merged into the container slot of KlyBanner , after the theme and the app configuration.
Icon Classes merged into the icon slot of KlyBanner , after the theme and the app configuration.
Content Classes merged into the content slot of KlyBanner , after the theme and the app configuration.
Title Classes merged into the title slot of KlyBanner , after the theme and the app configuration.
Description Classes merged into the description slot of KlyBanner , after the theme and the app configuration.
Actions Classes merged into the actions slot of KlyBanner , after the theme and the app configuration.
Close Classes merged into the close slot of KlyBanner , after the theme and the app configuration.