Platforms
What runs where, what each environment needs, and the limitations of this version. The facts below come from the project files (IsAotCompatible, IsTrimmable, Supported) and from the component code.
On this page
Packages at a glance
Klyroo. |
Klyroo. |
|
|---|---|---|
| Target framework | net11.0 |
net11.0 |
| Depends on | nothing | Klyroo., Klyroo. |
IsTrimmable |
yes | yes |
IsAotCompatible |
yes | not declared |
| Declared platforms | any | browser, ios, android, maccatalyst, windows |
| Static web assets | none | klyroo-display. |
Render modes
| Render mode | Components | Interactive features |
|---|---|---|
| Static server rendering | Render as markup. The names in a file list are plain links. A secret stays masked. | Copy, Show more, secret reveal, player controls and the file preview overlay do nothing, because they need event handlers. |
| Interactive Server | Everything works. | File is one instance per circuit. |
| Interactive WebAssembly | Everything works. | One instance for the app. Call AddKlyroo in the client project. |
| Interactive Auto | Everything works. | Call AddKlyroo in both projects. Each side has its own File, so an open preview does not carry from the server render to the client. |
Notes that apply to all modes:
- Copy buttons call
navigator.through JS interop and do nothing before the page is interactive. Browsers expose the Clipboard API only in secure contexts, so over plain HTTP, other than on localhost, copying can fail. A JavaScript error from the call is swallowed.clipboard. writeText - The file preview provider and the code that opens a file must share a scope. Put
<Klyin a layout that renders interactively (for example with global interactivity onFile Preview Provider /> <Routes />), or inside the interactive page that opens files. - Package stylesheets are loaded with ordinary
<link>elements, in any mode, see Getting started. - One JavaScript module, for the players. The audio and video players import
_once interactive. It drives the media element and reports back the position, the end of the clip, the player keys, and picture-in-picture and fullscreen support. The code and secret blocks use JS interop only for the clipboard. The preview provider imports the same module only to manage focus: it traps Tab inside its dialog and gives the focus back to the element that had it before the overlay opened.content/ Klyroo. Display/ klyroo-display-media. js
.NET MAUI Blazor Hybrid
Klyroo. declares browser, ios, android, maccatalyst and windows with Supported, which tells the platform compatibility analyzer that a MAUI app targeting those platforms can use it. In a Blazor Hybrid app:
- Call
builder.inServices. AddKlyroo Display() MauiProgram., aftercs AddMaui.Blazor Web View() - Add the stylesheets to the
<head>ofwwwroot/:index. html
<link rel="stylesheet" href="_content/Klyroo.UI/klyroo.preflight.css" />
<link rel="stylesheet" href="_content/Klyroo.UI/klyroo.css" />
<link rel="stylesheet" href="_content/Klyroo.Display/klyroo-display.css" />A BlazorWebView renders interactively, so no extra render mode is needed. The repository has no MAUI sample project and the test suite runs on bUnit, so behavior on a device or emulator is not covered here, in particular PDF display in an iframe and the Clipboard API inside each platform's web view. Test those on your target platforms.
Native C# MAUI without a web view
For a native MAUI UI with XAML and no BlazorWebView, install Klyroo. alone if you want to bind your own view models to File, CodeHighlighter, ParseCsv and the media models.
The repository also includes Klyroo. (src/): native .NET MAUI controls (KlyCodeBlock, KlySecretBlock, KlyFileList, KlyAudioPlayer, KlyVideoPlayer and KlyFile) over Klyroo., drawn with the design tokens of Klyroo. and no WebView. It requires the MAUI workload and a sibling checkout of klyroo-ui, and is built and unit-tested by ..
NativeAOT and trimming
Klyroo. sets IsAotCompatible and IsTrimmable, which turns on the trim, AOT and single-file analyzers at build, and the repository builds with warnings as errors. The sample in examples/ was published with NativeAOT for linux-x64 and runs:
dotnet publish examples/FilePreviewCoreExample -c Release -r linux-x64 -p:PublishAot=trueKlyroo. sets IsTrimmable, so it is safe to reference from a trimmed app, but it does not declare IsAotCompatible and its AOT behavior is not verified. Blazor WebAssembly ahead-of-time compilation of an app that uses it has not been tested here.
Known limitations
These are limits of the current code, not configuration errors.
- The media players need an interactive render mode. They drive their element from JavaScript once interactive, so under static server rendering the control bar shows but does not play.
Autoplaydepends on the browser. Most browsers refuse to start a player that is not muted before the user has interacted with the page; the player then stays paused.- Picture-in-picture and fullscreen depend on the browser. The video player shows those buttons only after the media module reports that the browser supports them, and hides picture-in-picture when
Seekableisfalse, because the element disables it then. Browsers accept these requests only shortly after a user gesture, and under Interactive Server the click makes a round trip to the server first, so a slow connection can make the browser refuse it. The audio player has neither button. - Syntax highlighting is lexical.
CodeHighlighterrecognizes comments, strings, numbers, keywords and a few naming heuristics (a name followed by(is a function, a capitalized name is a type); it does not parse, so a contextual keyword used as a name can be colored as a keyword. It covers the thirteenCodeLanguagevalues: C#, JavaScript, TypeScript, JSON, HTML (with Razor expressions, andscriptandstylecontents), XML, CSS, SCSS, Less, SQL, Python, Bash and YAML. JSX, indented Sass, TOML, INI and shell and SQL dialect details are not highlighted. A code over 100,000 characters or 5,000 lines is shown without colors, so a large file cannot slow the rendering. - The file preview has no renderer for Office files, archives and unknown files. They show a download card, or their
Renditionwhen you provide one. - Line numbers are drawn by CSS.
KlyCodeBlock.usesLineNumbers content: attr, so a copy of the rendered text, from the page or from a tool that reads the DOM, never contains them, and a print stylesheet that drops pseudo-elements drops them too.(data-line) - Built-in texts per locale. Labels such as "Show more", "No plays left" and the preview toolbar come from the
DisplayTextsset of the current Klyroo.UI locale, on every platform. Change a set inAddKlyrooDisplay.(d => d. Texts ("fr", t => t with { ... }))