menu_bookDocumentation

Editor Widgets

calendar_today May 3, 2026 schedule ~1 min read person patrickjr verified 50

Editor Widgets

Build custom editor UI using Widgets (different from in-game Panels).

Creating a Widget

CSHARP
public class ExampleWidget : Widget
{
    public ExampleWidget(Widget parent) : base(parent, false)
    {
        // Column layout with spacing
        Layout = Layout.Column();
        Layout.Margin = 4;
        Layout.Spacing = 4;
        
        // CSS styling (similar to Panels)
        SetStyles("background-color: #303445; color: white; font-weight: 600;");
        
        // Add children
        Layout.Add(new Label("Press the button:", this));
        var btn = Layout.Add(new Button("Click me!", this));
        btn.Clicked += () => Log.Info("Clicked!");
    }
}

Widget as Window

CSHARP
// No parent = root window
var window = new ExampleWidget(null);
window.Show();

Widget as Child

CSHARP
// With parent = child widget
var child = new ExampleWidget(parentWidget);
parentWidget.Layout.Add(child);

Dockable Widget

CSHARP
[Dock("Editor", "My Tool", "icon_name")]
public class MyDockWidget : Widget
{
    // Appears in View menu
    // Can be docked/undocked
}

Asset Editor Widget

CSHARP
[EditorForAssetType("item")]
public class ItemEditor : Window, IAssetEditor
{
    public bool CanOpenMultipleAssets => true;
    
    public void AssetOpen(Asset asset)
    {
        // Opened from double-click in Asset Browser
    }
}

Widget vs Panel

WidgetPanel
UseEditor UIIn-game UI
LocationEditor projectGame project
StylingCSSSCSS

Common Widgets

Was this helpful?