Requirements: .NET 8 or newer. TweakLane (the engine) targets net8.0 and has no third-party
dependencies. Pick the renderer for your UI framework:
| Package | UI framework | Targets |
|---|---|---|
TweakLane.Maui |
.NET MAUI | Android, iOS, Mac Catalyst, Windows (WinUI 3) |
TweakLane.Wpf |
WPF | Windows |
1. Install
Request access and create your app. The dashboard's setup step gets you the NuGet packages and the configuration for your app, with your public key filled in.
2. Register your controls
Each part is a stable id, a factory that returns your control, its alternatives and a
lock level. The factory gets a PartContext with the part's props, content
options, style and theme; return a MAUI View (or a WPF UIElement).
using TweakLane;
using TweakLane.Catalog;
using TweakLane.Rendering;
using TweakLane.Schema;
static ComponentCatalog MakeCatalog()
{
var catalog = new ComponentCatalog();
catalog.Register(new ComponentSpec
{
Id = "stats.list", DisplayName = "List", BaseHeight = 160,
Alternatives = EqList<string>.Of("stats.chart"),
DefaultProps = SchemaFns.JsonObject(("title", "This week")),
}, ctx => new StepsList(ctx.Props.String("title")));
catalog.Register(new ComponentSpec { Id = "stats.chart", DisplayName = "Chart", BaseHeight = 160 },
ctx => new StepsChart(ctx.Props.String("title")));
catalog.Register(new ComponentSpec { Id = "account.delete", DisplayName = "Delete account", Lock = LockLevel.Required },
_ => new DeleteAccountRow());
catalog.RegisterGenericPieces();
return catalog;
}
RegisterGenericPieces() adds the SDK's own stat, progress, text, image, button, divider and
spacer pieces, drawn by the renderer from the data fields and actions you Declare. See
Catalog for every field.
3. Provide a default document per screen
var today = new LayoutDocument
{
Screen = "today", Root = "root",
Nodes = EqList<LayoutNode>.Of(
LayoutNode.Container(NodeType.Scroll, "root", null, padding: 16),
LayoutNode.ComponentNode("greeting", "greeting", "root", 0, SchemaFns.JsonObject(("name", "Sam"))),
LayoutNode.Container(NodeType.Vstack, "summary", "root", 1, label: "Summary"),
LayoutNode.ComponentNode("stats.list", "stats", "summary", 0, SchemaFns.JsonObject(("title", "Steps"))),
LayoutNode.ComponentNode("account.delete", "account", "root", 3)),
};
The default document is the fallback for every failure, so it must be valid: RegisterDefault
throws on an invalid one.
4. Create the engine and render screens
using TweakLane.Engine;
using TweakLane.Maui; // or TweakLane.Wpf
using TweakLane.Persistence;
var store = new FileLayoutStore(Path.Combine(FileSystem.AppDataDirectory, "tweaklane"));
var engine = new TweakLaneEngine(MakeCatalog(), "local", store);
engine.RegisterDefault(today);
var page = new ContentPage { Content = new TweakScreen(engine, "today") };
TweakScreen reads the saved layout once per session, validates it and renders it. The layout
only changes while the user edits. TweakHooks passes your live data (Data), presence checks,
fonts and extra tray actions: new TweakScreen(engine, "today", new TweakHooks { Data = … }).
Handle actions that parts and buttons trigger with engine.ActionHandler = action => ….
5. Open edit mode
customizeButton.Clicked += (_, _) => engine.BeginEditing("today");
Each part shows a compact toolbar (drag handle, name, lock badge, Hide and an edit menu). The
tray at the bottom shows undo, redo, the last change and Done, the AI request field, and five
tools: Add, Hidden, Theme, History and More. To pin the tray outside your own scroll view, place
new TweakEditTray(screen) yourself.
Keep important state in your own view models: moving or swapping a part creates its control again.
6. Turn on sync
Create an app in the dashboard to get its public SDK key and API URL, then:
using TweakLane.Sync;
var engine = new TweakLaneEngine(MakeCatalog(), account.Id, store,
sync: new SyncConfiguration
{
BaseURL = "{TWEAKLANE_URL}",
PublishableKey = "tl_pk_…",
TokenProvider = new ClosureTokenProvider((userId, forceRefresh) =>
myBackend.TweakLaneTokenAsync(userId, forceRefresh)),
AppVersion = AppInfo.VersionString,
});
Edits are saved on the device first and sent when the device is online; the queue survives
restarts. Your backend issues the user token. See Connect your backend. Call
engine.SetUser(id) when the signed-in user changes. Add ai: new AITweakConfiguration("…")
to let users describe a change in words.
The layout documents, manifest, validation rules and issue codes are the same as on every other SDK: the .NET SDK runs the same shared fixtures. Next: Connect your backend.