Kael ships a rich standard library of UI primitives that cover the vast majority of what native desktop applications need. Every element is GPU-accelerated, composable, and styled through the same Tailwind-inspired API. Whether you are building a simple form or a data-dense dashboard, these building blocks form the foundation of every Kael render tree.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/Augani/kael/llms.txt
Use this file to discover all available pages before exploring further.
Container: div()
div() is the core layout container in Kael — the equivalent of the HTML <div>. It accepts children, handles all layout and style methods, and is the primary surface for binding mouse events, focus, tooltips, and context menus. Most custom components are assembled from one or more div() calls.
Composing children
EveryParentElement — including div() — exposes three composition helpers:
| Method | Signature | Purpose |
|---|---|---|
.child() | fn child(self, child: impl IntoElement) -> Self | Append a single child |
.children() | fn children(self, children: impl IntoIterator<Item = impl IntoElement>) -> Self | Append multiple children from any iterator |
.when() | fn when(self, condition: bool, then: impl FnOnce(Self) -> Self) -> Self | Conditionally apply a modifier or add children |
.when_some() | fn when_some<T>(self, option: Option<T>, then: impl FnOnce(Self, T) -> Self) -> Self | Apply a modifier only when an Option is Some |
Image: img()
img() renders raster images from a URL, embedded asset path, file-system path, or a pre-cached RenderImage. The element handles async loading, animated GIFs and WebP, and participates in an optional shared ImageCache.
ImageSource accepts &str, String, SharedString, PathBuf, Arc<Path>, or a SharedUri — the constructor sniffs whether the string looks like a URI and routes it accordingly. You can also supply a fully custom loading closure:
img() shows nothing while loading and nothing on error by default. Use .with_loading() and .with_fallback() (available on the Lottie element — see below) as a pattern to adopt in custom wrappers.SVG: svg()
svg() renders vector graphics from a file path. It participates in the same Interactivity system as div(), so you can attach click handlers, tooltips, and accessibility attributes.
Icon: icon()
icon() renders named icons from Kael’s generated icon atlas. Icons are resolved by name at paint time, so there is no per-call file I/O.
Canvas: canvas()
canvas() provides direct access to Kael’s GPU paint pipeline without defining a full custom element. It supports two calling conventions:
- Immediate-mode (recommended)
- Low-level (prepaint + paint)
Pass a size expression and a drawing closure that receives a
DrawContext. This is the higher-level API.Canvas drawing API
When you useDrawContext, you have access to the following immediate-mode drawing primitives:
Stroke value with the stroke() helper:
StrokeDash lets you draw dashed lines:
Label: label()
label() is an accessible text primitive that optionally forwards focus to another control when clicked, making it ideal for pairing with form fields.
Lottie animation: lottie()
lottie() renders .lottie or .json Lottie animations using an off-thread renderer with frame prefetching. Frames are cached in the GPU atlas.
Overlay elements
Kael provides three overlay primitives for floating UI. These are covered in detail in the Overlays API reference, but a quick summary:| Constructor | Signature | Purpose |
|---|---|---|
modal() | modal(id, open: bool) | Full-screen blocking overlay with dismiss-on-backdrop-click |
popover() | popover(id, open: bool) | Anchored floating panel that dismisses on outside interaction |
anchored() | anchored() | Low-level anchor primitive for positioning floating content relative to a target element |