D Donkeh docs
GitHub

HTML elements

HtmlHelper exposes 138 typed factories covering the common HTML elements, from the HTML5 structural set to legacy tags. All of them produce the same element nodes as the generic H(tag, props, children) helper, so the two styles mix freely.

using Donkeh.UILab;
using static Donkeh.UILab.HtmlHelper;
using static Donkeh.UILab._;

Div(new() { ClassName = "card" },
    H2(new() { ClassName = "card-title" }, Text("Files")),
    P(new() { ClassName = "card-copy" }, Text("12 items")),
    A(new() { Href = "/files" }, Text("Open")));

Props and attributes

Every helper takes a Props instance. Common attributes are first-class properties; anything else goes through the Attributes dictionary.

GroupProperties
IdentityId, ClassName, Title, Role, Key
Links and mediaHref, Src, Alt, Target, Rel
FormsType, Value, Placeholder, Name, Disabled, Checked, TabIndex
Anything elseAttributes = new Dictionary<string, string> { ["data-id"] = "42" }

Boolean properties emit an empty presence attribute when true and disappear when false or null. Entries in Attributes are applied after the dedicated properties. A class entry adds tokens to ClassName; an id entry replaces Id.

Event handlers are props as well. Simple properties such as OnClick and OnInput receive only the useful value, while the On…Event variants receive the full event object. See the event reference for every dispatched event, its class and its payload.

Button(new()
{
    ClassName = "primary",
    Disabled = isBusy,
    Attributes = new Dictionary<string, string>
    {
        ["data-command"] = "save",
        ["aria-label"] = "Save changes"
    }
}, Text("Save"));

Element reference

The factories below are available from using static Donkeh.UILab.HtmlHelper;. Block elements default to display: block, phrasing content to display: inline, replaced and form content to inline-block, and unknown tags to inline-block.

GroupHelpers
Document and rootsHtml, Head, Body, Title, Meta, Link, Base, Style, Script, Template, Noscript
Sectioning and flowDiv, Main, Section, Article, Aside, Header, Footer, Nav, Figure, Figcaption, Blockquote, Address, Details, Summary, Dialog, Center, Hr, Pre, Br, Search, Menu, Dir, Hgroup
Text and inlineSpan, A, Strong, Em, B, I, U, S, Small, Sub, Sup, Code, Kbd, Samp, Var, Mark, Abbr, Cite, Q, Time, Label, Output, Ruby, Rt, Rp, Rb, Rtc, Bdi, Bdo, Wbr, Del, Ins
Headings, text and listsH1–H6, P, Ul, Ol, Li, Dl, Dt, Dd
FormsForm, Fieldset, Legend, Input, Textarea, Select, Option, Optgroup, Button, Datalist, Progress, Meter, Keygen, Isindex
TablesTable, Caption, Colgroup, Col, Thead, Tbody, Tfoot, Tr, Th, Td
Media and embeddedImg, Picture, Source, Video, Audio, Canvas, Iframe, Object, Embed, Applet, Map, Area, Param, Track
Legacy and miscAcronym, Basefont, Bgsound, Big, Blink, Font, Frame, Frameset, Marquee, Menuitem, Nobr, Noembed, Noframes, Plaintext, Spacer, Strike, Tt, Xmp, Slot, Data

Custom and unknown tags

Any tag name is accepted. Use H when there is no typed helper; the element participates in CSS like any other box and defaults to inline-block until a rule changes its display.

H("my-badge", new()
{
    ClassName = "badge",
    Attributes = new Dictionary<string, string>
    {
        ["data-count"] = "3"
    }
}, Text("New"));

Behaviour by element

ElementNotes
imgReplaced content with intrinsic sizing, source resolution, object-fit and a shared texture cache. See Image.
videoDesktop and Android use a LibVLC player whose frames become textures. See Video.
canvasDesktop uses batched Silk.NET drawing or raw OpenGL; browser drawing is not wired yet. See Canvas.
audioDesktop and Android use the window-side audio player and paint transport controls. It has no visual box when controls is absent.
inputText-like types are editable with click-to-place caret, arrow and word navigation, selection, scrolling to the caret and caret-color/::selection support. Checkbox, radio, range, colour and file inputs are host-painted and interactive. Other types still render as controls.
select, optionThe selected option and a dropdown chevron are painted by the host. Arrow keys, Home/End, Enter/Space and type-ahead navigate the option list. Option elements are hidden in the user-agent sheet.
textareaEditable multi-line text with click-to-place caret, Up/Down line movement, line-aware Home/End, selection, internal scrolling, caret and placeholder support.
table familyTable layout, collapse and spacing are supported. Use normal table structure; anonymous table boxes are not synthesised for arbitrary children.
picture, sourceParsed as elements, but responsive source selection is not implemented. img uses its own src.
iframe, object, embedRender a stable 300 × 150 placeholder box. They do not load or embed external documents.
script, style, link, metaHidden by the user-agent sheet. Scripts are never executed and link stylesheets are never fetched; load CSS through [Stylesheet].
Browser host On WebAssembly the tree is mirrored to real DOM elements, so native browser behaviour applies. Desktop and Android use the CSS engine, layout and paint pipeline instead. Elements with host-specific behaviour are called out above.

Fonts and WOFF

The native host discovers installed system fonts by family and falls back by codepoint. A custom host can add a font without installing it system-wide:

var window = new DonkehWindow(settings);

window.Fonts.RegisterFont("Inter", "Assets/Inter.woff2");

window.Run(root, styles);

TTF, OTF, WOFF and WOFF2 files are accepted. WOFF containers are expanded to sfnt before the normal metrics, glyph atlas and fallback pipeline runs. RegisterFont wins over system discovery for that family; the browser host delegates font loading to the browser instead.

The native host also resolves external author stylesheets. Absolute or relative @import URLs are fetched and inlined, and each @font-face block downloads its first supported font source and registers the family automatically. Relative URLs resolve against the stylesheet that declared them. Failures leave the original rule in place and keep the fallback font chain.

@import url('https://cdnjs.cloudflare.com/ajax/libs/font-awesome/7.3.1/css/all.css');

.fa-bars {
    font-size: 48px;
}