Skip to content
Overview

Overview

Accessible Blazor components styled with Tailwind CSS v4, for .NET developers who build web apps and .NET MAUI Blazor Hybrid apps.

On this page

Klyroo.UI gives a Blazor app a complete set of components, a design system built on CSS variables and a build that bundles icons, fonts and Tailwind for you. Opening, closing, focus and keyboard handling run in the browser, so the components work in static server rendering, Interactive Server, WebAssembly and Auto, and in a BlazorWebView.

Components

Every component name starts with Kly, so Button is KlyButton. The list counts the 143 public components that you place in a page. The records they take (KlyTabItem, KlySelectItem, ...), the *Ui slot records, the base classes and the internal helper components that the API reference also lists are not counted.

  • Elements (20): Button, Badge, Avatar, AvatarGroup, Card, Alert, Banner, Chip, Container, Empty, FieldGroup, Icon, Image, InfiniteScroll, Kbd, Link, Progress, Separator, Skeleton, User
  • Form (25): Form, FormField, Input, InputNumber, InputTags, InputMenu, InputDate, InputTime, InputRating, PinInput, Textarea, Checkbox, CheckboxGroup, Switch, RadioGroup, Select, SelectMenu, Listbox, Slider, RangeSlider, Toggle, ToggleGroup, Calendar, ColorPicker, FileUpload
  • Overlay (9): Modal, Slideover, Drawer, Popover, Tooltip, DropdownMenu, ContextMenu, CommandPalette, Toaster
  • Color mode (5): ColorModeButton, ColorModeSwitch, ColorModeSelect, ColorModeAvatar, ColorModeImage
  • Navigation (12): Tabs, Accordion, Collapsible, Breadcrumb, Pagination, Stepper, Timeline, NavigationMenu, Tree, Marquee, ScrollArea, Splitter
  • Content (5): ContentNavigation, ContentSearch, ContentSearchButton, ContentSurround, ContentToc
  • Data (4): Table, Column, Chart, Carousel. KlyTable is a simple client-side table over a list you already hold; for server data, paging and filters use Klyroo.Table
  • Layout (10): App, Header, Main, Footer, FooterColumns, Sidebar, SkipLink, Error, LocaleSelect, Theme
  • Page (23): Page, PageHeader, PageHero, PageSection, PageFeature, PageGrid, PageColumns, PageCard, PageCta, PageLinks, PageList, PageLogos, PageAnchors, PageAside, PageBody, AuthForm, PricingPlan, PricingPlans, PricingTable, BlogPost, BlogPosts, ChangelogVersion, ChangelogVersions
  • Dashboard (10): DashboardGroup, DashboardSidebar, DashboardSidebarCollapse, DashboardSidebarToggle, DashboardPanel, DashboardResizeHandle, DashboardNavbar, DashboardToolbar, DashboardSearch, DashboardSearchButton
  • Chat (9): ChatMessages, ChatMessage, ChatPrompt, ChatPromptSubmit, ChatPalette, ChatAttachment, ChatReasoning, ChatShimmer, ChatTool
  • Editor (6): Editor, EditorToolbar, EditorDragHandle, EditorSuggestionMenu, EditorMentionMenu, EditorEmojiMenu
  • Head (5): ColorModeScript, CultureMeta, Fonts, Head, ThemeStyle (the components that go in <head>)

Prerequisites

To use the library in an app:

  • The .NET 11 SDK, and an app that targets net11.0. The packages are prereleases, so every dotnet add package command needs --prerelease.
  • A Blazor app: a Blazor Web App (static server rendering, Interactive Server, WebAssembly or Auto) or a .NET MAUI Blazor Hybrid app. Components that call .NET when the user acts (OnClick, @bind-Open) need an interactive render mode; the others also work in static server rendering. In a WebAssembly or Auto app, register the services in the server project and in the .Client project.
  • A browser with the native popover API, which Klyroo.UI uses: Chrome and Edge 114, Safari 17 or Firefox 125, or later. In a .NET MAUI app, that means iOS or Mac Catalyst 17, or an Android System WebView 114 or later.
  • Network access on the first build only if your app self-hosts web fonts (KlyrooFont), uses icons outside the built-in set, or compiles Tailwind (KlyrooTailwind): the build downloads them once and caches them under obj/klyroo. Node.js is not needed.
  • Tailwind CSS is optional. Without it, link the precompiled stylesheets. With Tailwind v4 in your app, turn on KlyrooTailwind: the build runs the Tailwind standalone binary, so no Node.js either.

To build this repository you need the .NET 11 SDK (a newer SDK works too, see global.json) and clones of klyroo-query and klyroo-stack (klyroo-query and klyroo-stack are used by the test projects only) in the same parent folder: some projects reference them by relative path (../klyroo-query/...). See Contributing.

Installation

Shell
dotnet add package Klyroo.UI --prerelease

Register the services in the server Program.cs and, for a WebAssembly or Auto app, in the .Client project with the same configuration:

C#
using Klyroo.UI;

builder.Services.AddKlyrooUi();

Import the namespace in _Imports.razor:

Razor
@using Klyroo.UI

Load the styles in <head> of App.razor. Without Tailwind in your app, link the precompiled sheets:

Razor
<KlyColorModeScript />
<KlyThemeStyle />
<link rel="stylesheet" href="@Assets["_content/Klyroo.UI/klyroo.preflight.css"]" />
<link rel="stylesheet" href="@Assets["_content/Klyroo.UI/klyroo.css"]" />

If your app compiles Tailwind v4, turn on KlyrooTailwind in the project file, import the Klyroo theme after Tailwind and load your own compiled sheet instead:

XML
<PropertyGroup>
  <KlyrooTailwind>true</KlyrooTailwind>
</PropertyGroup>
CSS
@import "tailwindcss";
@import "../obj/klyroo/klyroo.theme.css";

Remove Bootstrap if the Blazor template added it: CSS outside a cascade layer overrides the layered CSS of Tailwind v4.

Quick start

Wrap the layout in KlyApp, once, around the body. It renders the toaster and the host of IKlyOverlayService (dialogs opened from code), resolves the locale and writes lang and dir:

Razor
@inherits LayoutComponentBase

<KlyApp>
    <KlyMain>
        @Body
    </KlyMain>
</KlyApp>

Then use the components:

Razor
@page "/settings"

<KlyFormField Label="Display name">
    <KlyInput @bind-Value="_name" Placeholder="Ada Lovelace" />
</KlyFormField>
<KlySwitch @bind-Value="_notify" Label="Email notifications" />
<KlyPopover>
    <ChildContent><KlyButton Label="Details" Variant="ButtonVariant.Outline" /></ChildContent>
    <Content><p class="p-3">Opens and closes in the browser, with no round trip.</p></Content>
</KlyPopover>
<KlyButton Label="Save" OnClick="SaveAsync" />

@code {
    private string? _name;
    private bool _notify = true;

    private Task SaveAsync() => Task.CompletedTask;
}

The popover has no @bind-Open, so .NET is never called when it opens. The save button has an OnClick, so it renders disabled until the page is interactive; use Href or Type="ButtonType.Submit" on a button that must work in a static page. Getting started builds a complete form step by step.

Theming

Map the semantic colors to palettes in AddKlyrooUi. Klyroo.UI computes the fill, the text color and the on-fill color for light and dark mode and keeps the contrast ratios.

C#
using Klyroo.UI;

builder.Services.AddKlyrooUi(o =>
{
    o.Colors.Primary = KlyPalette.Blue;
    o.Colors.Neutral = KlyPalette.Zinc;
    o.Colors.Add("tertiary", KlyPalette.Indigo);
    o.Button.Slot("base", "font-semibold");
});

Four levels of customization, from the broadest to the narrowest: the palettes, the --klyroo-* CSS variables, the theme of each component in AddKlyrooUi, and the Class and Ui parameters of one instance. See the guides and Concepts.

Documentation

Getting started Step-by-step first integration
Guides Task-oriented recipes
Concepts How the library works
Platforms Render modes, .NET MAUI, NativeAOT
API reference Every public type and member
FAQ Troubleshooting and limitations

Compatibility

  • The .NET 11 SDK. Every package targets net11.0.
  • Static server rendering, Interactive Server, WebAssembly and Auto, and a .NET MAUI BlazorWebView. The components use the native popover API, so a web view needs iOS 17 or Mac Catalyst 17, or an Android System WebView of Chrome 114 or later.
  • Klyroo.UI, Klyroo.UI.Images and Klyroo.UI.Server declare IsAotCompatible: the trimming and AOT analyzers report no warning. No NativeAOT app is published and tested here, and Klyroo.UI.Images.Local does not declare it.
  • Fonts, icons and Tailwind are resolved by the build, which needs the network once (or a filled cache). Tailwind needs no Node.

Contributing

Contributions are welcome. Read CONTRIBUTING.md before opening a pull request, and follow the code of conduct. Report security issues privately as described in SECURITY.md.

License

MIT