Klyroo.Display.Core
0.1.0-preview.2
dotnet add package Klyroo.Display.Core --version 0.1.0-preview.2
NuGet\Install-Package Klyroo.Display.Core -Version 0.1.0-preview.2
<PackageReference Include="Klyroo.Display.Core" Version="0.1.0-preview.2" />
<PackageVersion Include="Klyroo.Display.Core" Version="0.1.0-preview.2" />
<PackageReference Include="Klyroo.Display.Core" />
paket add Klyroo.Display.Core --version 0.1.0-preview.2
#r "nuget: Klyroo.Display.Core, 0.1.0-preview.2"
#:package Klyroo.Display.Core@0.1.0-preview.2
#addin nuget:?package=Klyroo.Display.Core&version=0.1.0-preview.2&prerelease
#tool nuget:?package=Klyroo.Display.Core&version=0.1.0-preview.2&prerelease
Klyroo.Display
Rich content for Blazor: a syntax-highlighted code block, a masked secret block, a file list with a file preview overlay, and audio and video players, with a UI-free core for code highlighting, file detection and CSV parsing.
Some content needs more than markup: code that has to be colored, copied and annotated, a value that must stay masked until the user asks, a list of attachments that opens in a viewer, a clip with a play limit. Klyroo.Display ships those as distinct typed components, each with only the parameters it reads, and keeps the logic behind them in a core package with no UI dependency, so the highlighter and the file helpers also run in an API or a worker. File preview works through a service: you inject it, call Open, and a provider renders the overlay. The Blazor package targets Blazor Web Apps and declares support for .NET MAUI Blazor Hybrid platforms. The plain read-only blocks (alerts, statistics, tables, timelines and the like) are components of Klyroo.UI.
Features
- Syntax highlighting:
KlyCodeBlockcolors C#, JavaScript, TypeScript, JSON, HTML, XML, CSS, SCSS, Less, SQL, Python, Bash and YAML from a typedCodeLanguage, with a label, a copy button, optional line numbers and emphasized lines (HighlightLines), and the file preview does the same from the file extension. The scanner isCodeHighlighterinKlyroo.Display.Core: dependency-free, trim and AOT safe, it never throws, andCodeHighlighter.Highlight(code, language)returns escaped markup for pages that Blazor does not render. - Secret values:
KlySecretBlockmasks all but the last characters of a value, with a Reveal toggle and a copy button, and never highlights it. - File list and preview overlay:
KlyFileListlists files (FileListItem: aFilePreviewFilewith an optional description, meta text, icon and tone) with an extension badge, a size and a date, and a click opens them as a gallery in the overlay.KlyFilePreviewProvidershows PDF, images, video, audio, CSV, Markdown and text in a modal, drawer or fullscreen panel, with keyboard navigation, image zoom and rotation, a details panel and downloads. - Headless file helpers:
Klyroo.Display.Coredetects a file kind from its MIME type or extension, parses CSV and TSV (RFC 4180 quoting, delimiter detection) and formats sizes, and it is NativeAOT compatible. - Audio and video players with clip and play-limit rules:
KlyAudioPlayerandKlyVideoPlayerplay a clip window of a file, enforce a play quota and a non-seekable timeline, and report progress and the end of each play through callbacks. Their control bar has volume, speed, captions, picture-in-picture and fullscreen controls, and a compact size. - Themeable like Klyroo.UI: each block has slots with default classes (
KlyrooDisplayOptions.CodeBlock,SecretBlockandFileList) that you extend inAddKlyrooDisplay, and a typedUiparameter (CodeBlockUi,SecretBlockUi,FileListUi) for one instance. - Translated texts: the built-in labels follow the Klyroo.UI locale, with a
DisplayTextsset for each of its twelve languages (English and French reviewed), andAddKlyrooDisplay(d => d.Texts("fr", t => t with { ... }))changes any of them.
Packages
| Package | Description |
|---|---|
Klyroo.Display.Core |
CodeHighlighter and CodeLanguage, FilePreviewService, file kind detection, CSV parser and the file and media models. No UI dependency. |
Klyroo.Display |
KlyCodeBlock, KlySecretBlock, KlyFileList, KlyAudioPlayer, KlyVideoPlayer and KlyFilePreviewProvider for Blazor. Builds on Klyroo.UI and includes the Core package. |
For native .NET MAUI apps without a BlazorWebView, the repository also includes Klyroo.Display.Maui (built from source over Klyroo.Display.Core and Klyroo.UI.Maui).
Prerequisites
To use the library in an app:
- The .NET 11 SDK, and an app that targets
net11.0. The packages are prereleases, so everydotnet add packagecommand needs--prerelease. Klyroo.Display.Corealone (code highlighting, file kinds, CSV parsing, sizes) runs in any .NET 11 app.- A Blazor app for
Klyroo.Display: a Blazor Web App or a .NET MAUI Blazor Hybrid app. The code, secret and file list blocks render in static server rendering; the media players, copy buttons, the Reveal toggle, Show more and the file preview need an interactive render mode. In a WebAssembly or Auto app, register the services in the server project and in the.Clientproject. - Klyroo.UI set up in the app.
Klyroo.Displaybrings the Klyroo.UI package, andAddKlyrooDisplay()registers its services, but the layout still needs the Klyroo.UI stylesheets in<head>and<KlyApp>around the body, as described in the Klyroo.UI installation. <KlyFilePreviewProvider>in the layout to open file previews, and a secure context (HTTPS orlocalhost) for the copy buttons, which use the clipboard API.- 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 underobj/klyroo. Node.js is not needed.
To build this repository you need the .NET 11 SDK (a newer SDK works too, see global.json) and a clone of klyroo-ui in the same parent folder: some projects reference it by relative path (../klyroo-ui/...). See Contributing.
Installation
dotnet add package Klyroo.Display --prerelease
For code that has no UI, such as an API or a worker, install only the core:
dotnet add package Klyroo.Display.Core --prerelease
Register the services in Program.cs, and in the client project too when you use WebAssembly or Auto:
using Klyroo.Display;
builder.Services.AddKlyrooDisplay();
Import the namespaces in _Imports.razor:
@using Klyroo.UI
@using Klyroo.Display
Load the stylesheets in App.razor, inside <head>. klyroo-display.css is the compiled Tailwind classes the components use:
<link rel="stylesheet" href="@Assets["_content/Klyroo.UI/klyroo.preflight.css"]" />
<link rel="stylesheet" href="@Assets["_content/Klyroo.UI/klyroo.css"]" />
<link rel="stylesheet" href="@Assets["_content/Klyroo.Display/klyroo-display.css"]" />
Quick start
Headless, with Klyroo.Display.Core:
using Klyroo.Display;
var csv = FilePreviewService.ParseCsv("Item;Price\nDesk;299.90\nChair;149.00", "catalog.csv");
Console.WriteLine($"{csv.Rows.Count} rows, delimiter '{csv.Delimiter}', price column numeric: {csv.NumericColumns[1]}");
Console.WriteLine(FilePreviewService.DetectKind("report.pdf")); // Pdf
Console.WriteLine(FilePreviewService.FormatFileSize(1_572_864)); // 1.5 MB
var language = CodeHighlighter.ResolveFileName("Program.cs"); // CodeLanguage.CSharp
Console.WriteLine(CodeHighlighter.Highlight("var n = 42;", language!.Value));
// <span data-token="keyword">var</span> n <span data-token="punctuation">=</span> <span data-token="number">42</span><span data-token="punctuation">;</span>
In a Blazor page:
<KlyCodeBlock Code="@Snippet" Language="CodeLanguage.Sql" Label="Query" LineNumbers
HighlightLines="@([2, new CodeLineRange(4, 5)])" />
<KlySecretBlock Label="API key" Value="sk_test_9876543210" />
<KlyFileList Title="Attachments" Files="_files" />
@code {
private const string Snippet = "SELECT id, total\nFROM orders\nWHERE status = 'paid'\n AND total > 100\nORDER BY total DESC;\n";
private readonly IReadOnlyList<FileListItem> _files =
[
new FilePreviewFile { Src = "/files/spec.pdf", Size = 1_572_864 },
new FileListItem(new FilePreviewFile { Src = "/files/metrics.csv", Size = 18_400 }, Description: "March export"),
];
}
To preview files, add <KlyFilePreviewProvider /> once to an interactive layout, inject FilePreviewService where you need it and call Open. Getting started builds that end to end.
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
- .NET 11 SDK.
Klyroo.Display.Coreruns anywhere .NET 11 runs and is markedIsAotCompatibleandIsTrimmable.Klyroo.Displayrenders in Interactive Server, WebAssembly, Auto and static server rendering. Copy buttons, the Reveal toggle, Show more, the player controls and the file preview overlay need an interactive render mode.Klyroo.Displaydeclaresbrowser,ios,android,maccatalystandwindowsas supported platforms for .NET MAUI Blazor Hybrid. It is markedIsTrimmablebut notIsAotCompatible.Klyroo.Displaydepends onKlyroo.UIfor theming and the base components.
Klyroo ecosystem
Klyroo is a family of independent .NET libraries that compose. Each one has its own repository, versions and releases.
| Library | Description |
|---|---|
| Klyroo.UI | Accessible Blazor components for the web and .NET MAUI Blazor Hybrid, styled with Tailwind CSS v4 |
| Klyroo.Query | Typed query model, URL state sync, and IQueryable / EF Core execution |
| Klyroo.Table | Data lists with table and card-grid layouts, filters, selection and actions |
| Klyroo.Form | Schema-driven forms, validation and wizards |
| Klyroo.Dashboard | Dashboard controller, filters and Blazor blocks: stats, gauges, charts, tables and feeds |
| Klyroo.Display | Code highlighting, file preview and audio and video players |
| Klyroo.Spreadsheet | Import wizard for CSV, TSV and pasted data, with column and value mapping |
| Klyroo.Agent | Bridge that lets AI agents read and act on Klyroo forms, dashboards and imports |
| Klyroo.Hotkey | Server-side .NET client for Hotkey cloud browsers, human handoffs and signed webhooks |
| Klyroo.Stack | Meta-package, MCP documentation server and dotnet new templates |
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
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. net11.0 is compatible. |
-
net10.0
- No dependencies.
-
net11.0
- No dependencies.
NuGet packages (2)
Showing the top 2 NuGet packages that depend on Klyroo.Display.Core:
| Package | Downloads |
|---|---|
|
Klyroo.Stack.Core
Klyroo Core Meta-Package: aggregates all headless, NativeAOT-compatible Core engines of Klyroo (Query, Table, Form, Dashboard, Display, Spreadsheet, Agent) and the KlyrooStackCatalog router. |
|
|
Klyroo.Display
Klyroo Display: rich content for Blazor Web and .NET MAUI Hybrid. A syntax-highlighted code block, a masked secret block, a file list and file preview overlay, and Audio and Video players with clip rules. |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 0.1.0-preview.2 | 38 | 11/29/2026 |
| 0.1.0-preview.1 | 41 | 11/29/2026 |