English | 简体中文
Manta is a UI toolkit and MVVM framework for building cross-platform desktop applications on Avalonia. It provides themeable controls, an explicit MVVM runtime, and compile-time code generation.
- A broad set of
M-prefixed controls, plus themed styles for supported Avalonia controls. - Light and dark themes built on the OKLch color space.
Model,ViewModel,WindowModelandDialogModelbase classes for the MVVM layer.- Attribute-based view registration that generates view creation at compile time.
- Native AOT and trimming compatibility, with reflection-free view and language generation.
- Region and tab navigation with
RegionManager<T>. - Modal dialogs with
DialogModel. - Type-safe language keys generated from YAML files.
Manta targets .NET 10 and Avalonia 12. Packages are published to NuGet.org.
dotnet add package ONEO.Manta
dotnet add package ONEO.Manta.GeneratorsAdd ONEO.Manta.Generators to use the [View<T>] and language-key generators.
Manta is Native AOT and trimming compatible. The library builds with IsAotCompatible, and its generators wire views and language keys without reflection-based discovery. MantaDemo publishes with PublishAot in Release.
<PropertyGroup>
<PublishAot>true</PublishAot>
<PublishTrimmed>true</PublishTrimmed>
</PropertyGroup>Create the application entry point and subclass MApp:
using Avalonia;
using Manta;
static class Program
{
[STAThread]
public static void Main(string[] args)
{
MApp.Build<App>().StartWithClassicDesktopLifetime(args);
}
}Register the theme and a main window model in the application:
<MApp xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
x:Class="MyApp.App">
<MApp.Styles>
<MantaTheme />
</MApp.Styles>
</MApp>sealed class App : MApp
{
public override void Initialize() => AvaloniaXamlLoader.Load(this);
protected override void OnInitialize(out MAppOptions options)
{
options = new() { MainModel = () => new Main_Model() };
}
}Pair a view model with its view using the View attribute. The generator supplies CreateView, so the model only declares its bindings:
[View<Main>]
sealed partial class Main_Model : WindowModel
{
}
sealed partial class Main : MView
{
public Main() => InitializeComponent();
}Read the architecture overview before extending the library.
samples/ holds standalone applications that consume the published packages instead of the projects under source/. MantaSample demonstrates startup, MVVM, region navigation, dialogs, localization and the common controls. MantaComponents is a plain Avalonia application that only adds the Manta theme and controls, without the Manta MVVM runtime. MantaThemeSample uses only the Manta theme variables, without any Manta control or runtime. AvaloniaI18nSample adds Manta localization to an otherwise stock Avalonia application.
cd samples
dotnet run --project MantaSample
dotnet run --project MantaComponents
dotnet run --project MantaThemeSample
dotnet run --project AvaloniaI18nSample- ARCHITECTURE.md maps the projects and the boundaries between them.
- The architecture subjects explain the MVVM runtime, theming and localization in depth.
Install the .NET 10 SDK. The library and demo projects live under source/; run the commands from there:
cd source
dotnet build Manta.slnx
dotnet run --project MantaDemoAfter editing a control's Design.PreviewWith block or theme files, regenerate the derived files:
dotnet run --project MantaPrepareRelease by pushing a v<major>.<minor>.<patch> tag. The release workflow publishes the packages to NuGet.org and creates the GitHub release, taking its body from the matching CHANGELOG.md section. Publishing uses NuGet trusted publishing: the workflow exchanges its GitHub OIDC token for a short-lived API key, so only the NUGET_USER repository secret (your nuget.org username) is required, and a trusted publishing policy for release.yml must exist on nuget.org.
Contributor rules live in AGENTS.md.
The marketing site lives in website/ and is built with React Router and shadcn/ui. The Website workflow deploys it to GitHub Pages.
cd website
bun install
bun run devSee website/README.md for the build and deployment details.
See CHANGELOG.md for user-visible changes.
Manta is released under the MIT license.
