Get started – C
Fuaran.UI.CSharp is an idiomatic C# author surface over the wire contract:
static factories + options records, required members that make a missing field a
compile error, and implicit conversions so Text = "Channel performance" binds with
no helper call. Encode calls the same canonical F# encoder every host uses – a
C#-authored tree produces the same bytes as its F# equivalent, with no parallel codec.
Install
dotnet add package Fuaran.UI
dotnet add package Fuaran.UI.CSharp
dotnet add package Fuaran.UI.Analyzers # optional – compile-time diagnostics for your trees
Author a tree
Compose the tree with the Fuaran.* factories – each injects the per-kind defaults
and ARIA. A bare string where a Text is expected becomes a Literal.
using Fuaran.UI.CSharp;
using static Fuaran.UI.CSharp.Fuaran; // the factory entry points as Dashboard(...), Heading(...), …
var tree = Dashboard(new()
{
Id = "root",
Children =
[
Heading(new() { Id = "title", Text = "Channel performance" }),
Markdown(new() { Id = "note", Text = "**Hello** from a Fuaran tree." }),
],
});
Encode to canonical wire JSON
string wire = tree.Encode();
// canonical JSON – byte-identical to the F#, TypeScript, and Python hosts
The tree you just built
Rendered by this very site from the exact JSON Encode produces – with a one-click
link into the playground:
Channel performance
Hello from a Fuaran tree.
{"accessibility":{"role":"main"},"id":"root","kind":{"$type":"Box","children":[{"id":"title","kind":{"$type":"Heading","level":2,"text":"Channel performance","variant":"Standard"}},{"id":"note","kind":{"$type":"Markdown","text":"**Hello** from a Fuaran tree."}}],"layout":{"$type":"Auto"},"role":"Dashboard"}}
Next
- Render it server-side with
Fuaran.UI.Renderer.Server– hand the encoded wire (or the node directly) to the SSR renderer, exactly as this site does. An embedded in-process browser renderer for .NET hosts is landing as a follow-up. - Mutate it as data – apply typed
TreeOps fromFuaran.UI.Opsinstead of rebuilding, and persist the op-stream for replay. - Prefer VB? The same tree as XML literals is the VB track.
- See the component reference for every node kind and the guide – including authoring from C#.