π AOT-Friendly, Zero-XAML, Svelte-like Reactive Framework for Avalonia UI.
Avalonia.Svelte brings the fluid reactive experience of modern web development to .NET desktop development. Build modern, high-performance cross-platform applications using pure C#, saying goodbye to verbose XAML and embracing type safety and code completion.
State<T> and Computed<T> that automatically tracks dependencies..Class(), .BindText()) and control flow components (Svelte.If, Svelte.Each).Router, Page, and Layout system, supporting route guards and parameter parsing.Writing a simple counter component has never been easier:
using Avalonia.Controls;
using Avalonia.Svelte.Core;
public class CounterPage : Component
{
// 1. Define State
private readonly State<int> _count = new(0);
// 2. Define Computed Property (automatically tracks _count)
private readonly Computed<string> _label;
public CounterPage()
{
_label = new Computed<string>(() => $"Current Count: {_count.Value}");
// 3. Build UI
Content = new StackPanel()
.Spacing(10)
.Children(
new TextBlock()
.BindTextContent(_label) // Bind text
.Class("h1"), // Apply style class
new Button()
.Content("Increment")
.OnClick(_ => _count.Value++), // Modify state directly
// 4. Control Flow
Svelte.If(_count > 10, () =>
new TextBlock()
.Text("Wow! That's high!")
.Color(Colors.Red)
)
);
}
}
(Coming soon to NuGet)
Currently, you can reference the projects in the src/ directory as source code in your solution.
Issues and PRs are welcome! Let's redefine the .NET desktop development experience together.
MIT License