SlintUITemplates
A platform-native Slint UI shell library. Declare what you want — AppShell, nav items, menus, content slots — and the framework delivers the correct platform-stereotyped UI without any layout decisions from the caller.
One declaration → one correct visual result per platform.
AppShell {
nav-items: [
{ id: "home", label: "Home", icon: FluentIcons.home },
{ id: "settings", label: "Settings", icon: FluentIcons.settings },
];
menus: [
{ id: "file", label: "File" },
{ id: "edit", label: "Edit" },
];
active-slot <=> root.active-view;
slot-changed(id) => { root.active-view = id; }
if root.active-view == "home": MyHomeView {}
if root.active-view == "settings": MySettingsView {}
}
On Windows: MenuBar → optional Toolbar → SideNav + Content → StatusBar (Fluent 2) On Android: TopAppBar + Content + BottomNavBar + FAB (Material 3) — Phase 11
Quick Start
Or as a dependency:
[]
= "0.1"
Feature flags
| Feature | Default | Enables |
|---|---|---|
rhai |
yes | Rhai scripting engine, view-config evaluation |
markdown |
yes | Markdown parser (docs module) |
Core-only (no scripting, no markdown):
[]
= { = "0.1", = false }
Architecture
AppShell (Windows — Fluent 2)
├── ShellMenuBar Fluent 2 application menu
├── ShellToolbar Optional icon toolbar
├── ShellSideNav NavigationView (collapsible, 48–280px)
├── ShellContentFrame @children content area
└── ShellStatusBar Bottom status + progress
MobileShell (Android — Material 3)
├── TopAppBar CenterAligned, nav icon, actions
├── Content + FAB @children + FloatingActionButton
└── BottomNavBar 3–5 destinations, active indicator pill
Mother-child pattern
Level 1 — Mother: AppWindow (inherits Window) — owns ALL state
Level 2 — Shell: AppShell / MobileShell — in property + callback
Level 3 — Modules: Button, Card, TextInput ... — atomic building blocks
Axiom: AppWindow is the ONLY state owner. Children receive via in property
and emit via callback. No in-out. No state in leaf components.
Token system
ui/tokens/theme.slint Single import — never import token files directly
├── Colors Fluent 2 light/dark (bg, text, accent, border, shadow)
├── Spacing 4px grid + control heights
├── Type Font sizes — reactive to Settings.zoom * font-scale
├── Scale Icon sizes — reactive to Settings.zoom
├── FluentColors/Spacing/... Exact WinUI3 values (source of truth)
├── FluentIcons ~60 Segoe Fluent Icon codepoints
└── MaterialColors/... Material Design 3 color roles + scales
Bi-directional layout engine
use ;
// Named-slot DSL v2
let mut panels = build_v2;
let delta = 0.05f32;
// Drag: both neighbors update, sum stays 1.0
drag; // sidebar ↔ content, inspector unchanged
drag; // content ↔ inspector, sidebar unchanged
Platforms
| Platform | Design System | Icons | Status |
|---|---|---|---|
| Windows 11 | Fluent 2 / WinUI3 | Segoe Fluent Icons | Active |
| Android | Material Design 3 | Material Symbols | Phase 11 |
| macOS | Aqua / SwiftUI | SF Symbols | Future |
| Linux | libadwaita/Breeze | GNOME/Breeze icons | Future |
Settings System
use ;
use AppAdapter;
let adapter = new.unwrap;
let settings = AppSettings ;
adapter.apply_settings;
Runtime Rhai scripting also supported:
;
;
;
Components
| Component | Key Props | Callback |
|---|---|---|
| Button | label, variant |
clicked() |
| Toggle | checked, label |
toggled(bool) |
| TextInput | text, placeholder, error |
changed(string) |
| SelectField | options, selected |
changed(string) |
| Avatar | initials, size |
— |
| Badge | text, variant |
— |
| Card | title, subtitle |
— |
| ProgressBar | value (0.0–1.0), show-label |
— |
| Toast | message, variant, visible |
closed() |
| Dialog | title, message, visible |
confirmed(), cancelled() |
| DragHandle | vertical |
dragged(dx,dy), drag-end(dx,dy) |
License
MIT — see LICENSE