ktsu.ImGuiWidgets 1.6.5-pre.16

Prefix Reserved
This is a prerelease version of ktsu.ImGuiWidgets.
There is a newer prerelease version of this package available.
See the version list below for details.
dotnet add package ktsu.ImGuiWidgets --version 1.6.5-pre.16
                    
NuGet\Install-Package ktsu.ImGuiWidgets -Version 1.6.5-pre.16
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="ktsu.ImGuiWidgets" Version="1.6.5-pre.16" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="ktsu.ImGuiWidgets" Version="1.6.5-pre.16" />
                    
Directory.Packages.props
<PackageReference Include="ktsu.ImGuiWidgets" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add ktsu.ImGuiWidgets --version 1.6.5-pre.16
                    
#r "nuget: ktsu.ImGuiWidgets, 1.6.5-pre.16"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#addin nuget:?package=ktsu.ImGuiWidgets&version=1.6.5-pre.16&prerelease
                    
Install ktsu.ImGuiWidgets as a Cake Addin
#tool nuget:?package=ktsu.ImGuiWidgets&version=1.6.5-pre.16&prerelease
                    
Install ktsu.ImGuiWidgets as a Cake Tool

ktsu.ImGuiWidgets

ImGuiWidgets is a library of custom widgets using ImGui.NET. This library provides a variety of widgets and utilities to enhance your ImGui-based applications.

Features

  • Knobs: Ported to .NET from ImGui-works/ImGui-knobs-dial-gauge-meter
  • Resizable Layout Dividers: Draggable layout dividers for resizable layouts
  • TabPanel: Tabbed interface with closable, reorderable tabs and dirty indicator support
  • Icons: Customizable icons with various alignment options and event delegates
  • Grid: Flexible grid layout for displaying items
  • Color Indicator: An indicator that displays a color when enabled
  • Image: An image widget with alignment options
  • Text: A text widget with alignment options
  • Tree: A tree widget for displaying hierarchical data
  • Scoped Id: A utility class for creating scoped IDs
  • SearchBox: A powerful search box with support for various filter types (Glob, Regex, Fuzzy) and matching options

Installation

To install ImGuiWidgets, you can add the library to your .NET project using the following command:

dotnet add package ktsu.ImGuiWidgets

Usage

To use ImGuiWidgets, you need to include the ktsu.ImGuiWidgets namespace in your code:

using ktsu.ImGuiWidgets;

Then, you can start using the widgets provided by ImGuiWidgets in your ImGui-based applications.

Examples

Here are some examples of using ImGuiWidgets:

Knobs

Knobs are useful for creating dial-like controls:

float value = 0.5f;
float minValue = 0.0f;

ImGuiWidgets.Knob("Knob", ref value, minValue);

The SearchBox widget provides a powerful search interface with multiple filter type options:

// Static fields to maintain filter state between renders
private static string searchTerm = string.Empty;
private static TextFilterType filterType = TextFilterType.Glob;
private static TextFilterMatchOptions matchOptions = TextFilterMatchOptions.ByWholeString;

// List of items to search
var items = new List<string> { "Apple", "Banana", "Cherry", "Date", "Elderberry" };

// Basic search box with right-click context menu for filter options
ImGuiWidgets.SearchBox("##BasicSearch", ref searchTerm, ref filterType, ref matchOptions);

// Display results
if (!string.IsNullOrEmpty(searchTerm))
{
    ImGui.TextUnformatted($"Search results for: {searchTerm}");
}

// Search box that returns filtered results directly
var filteredResults = ImGuiWidgets.SearchBox(
    "##FilteredSearch",
    ref searchTerm,
    items,                  // Collection to filter
    item => item,           // Selector function to extract string from each item
    ref filterType,
    ref matchOptions).ToList();

// Ranked search box for fuzzy matching and ranked results
var rankedResults = ImGuiWidgets.SearchBoxRanked(
    "##RankedSearch", 
    ref searchTerm, 
    items, 
    item => item).ToList();

TabPanel

TabPanel creates a tabbed interface with support for closable tabs, reordering, and dirty state indication:

// Create a tab panel with closable and reorderable tabs
var tabPanel = new ImGuiWidgets.TabPanel("MyTabPanel", true, true);

// Add tabs with explicit IDs (recommended for stability when tabs are reordered)
string tab1Id = tabPanel.AddTab("tab1", "First Tab", RenderTab1Content);
string tab2Id = tabPanel.AddTab("tab2", "Second Tab", RenderTab2Content);
string tab3Id = tabPanel.AddTab("tab3", "Third Tab", RenderTab3Content);

// Draw the tab panel in your render loop
tabPanel.Draw();

// Methods to render tab content
void RenderTab1Content()
{
    ImGui.Text("Tab 1 Content");
    
    // Mark tab as dirty when content changes
    if (ImGui.Button("Edit"))
    {
        tabPanel.MarkTabDirty(tab1Id);
    }
    
    // Mark tab as clean when content is saved
    if (ImGui.Button("Save"))
    {
        tabPanel.MarkTabClean(tab1Id);
    }
}

void RenderTab2Content()
{
    ImGui.Text("Tab 2 Content");
}

void RenderTab3Content()
{
    ImGui.Text("Tab 3 Content");
}

Icons

Icons can be used to display images with various alignment options and event delegates:

float iconWidthEms = 7.5f;
float iconWidthPx = ImGuiApp.EmsToPx(iconWidthEms);

uint textureId = ImGuiApp.GetOrLoadTexture("icon.png");

ImGuiWidgets.Icon("Click Me", textureId, iconWidthPx, Color.White.Value, ImGuiWidgets.IconAlignment.Vertical, new ImGuiWidgets.IconDelegates()
{
	OnClick = () => MessageOK.Open("Click", "You clicked")
});

ImGui.SameLine();
ImGuiWidgets.Icon("Double Click Me", textureId, iconWidthPx, Color.White.Value, ImGuiWidgets.IconAlignment.Vertical, new ImGuiWidgets.IconDelegates()
{
	OnDoubleClick = () => MessageOK.Open("Double Click", "You clicked twice")
});

ImGui.SameLine();
ImGuiWidgets.Icon("Right Click Me", textureId, iconWidthPx, Color.White.Value, ImGuiWidgets.IconAlignment.Vertical, new ImGuiWidgets.IconDelegates()
{
	OnContextMenu = () =>
	{
		ImGui.MenuItem("Context Menu Item 1");
		ImGui.MenuItem("Context Menu Item 2");
		ImGui.MenuItem("Context Menu Item 3");
	},
});

Grid

The grid layout allows you to display items in a flexible grid:

float iconSizeEms = 7.5f;
float iconSizePx = ImGuiApp.EmsToPx(iconSizeEms);

uint textureId = ImGuiApp.GetOrLoadTexture("icon.png");

ImGuiWidgets.Grid(items, i => ImGuiWidgets.CalcIconSize(i, iconSizePx), (item, cellSize, itemSize) =>
{
	ImGuiWidgets.Icon(item, textureId, iconSizePx, Color.White.Value);
});

Color Indicator

The color indicator widget displays a color when enabled:

bool enabled = true;
Color color = Color.Red;

ImGuiWidgets.ColorIndicator("Color Indicator", enabled, color);

Image

The image widget allows you to display images with alignment options:

uint textureId = ImGuiApp.GetOrLoadTexture("image.png");

ImGuiWidgets.Image(textureId, new Vector2(100, 100));

Text

The text widget allows you to display text with alignment options:

ImGuiWidgets.Text("Hello, ImGuiWidgets!");
ImGuiWidgets.TextCentered("Hello, ImGuiWidgets!");
ImGuiWidgets.TextCenteredWithin("Hello, ImGuiWidgets!", new Vector2(100, 100));

Tree

The tree widget allows you to display hierarchical data:

using (var tree = new ImGuiWidgets.Tree())
{
	for (int i = 0; i < 5; i++)
	{
		using (tree.Child)
		{
			ImGui.Button($"Hello, Child {i}!");
			using (var subtree = new ImGuiWidgets.Tree())
			{
				using (subtree.Child)
				{
					ImGui.Button($"Hello, Grandchild!");
				}
			}
		}
	}
}

Scoped Id

The scoped ID utility class helps in creating scoped IDs for ImGui elements and ensuring they get popped appropriatley:

using (new ImGuiWidgets.ScopedId())
{
    ImGui.Button("Hello, Scoped ID!");
}

Contributing

Contributions are welcome! For feature requests, bug reports, or questions, please open an issue on the GitHub repository. If you would like to contribute code, please open a pull request with your changes.

Acknowledgements

ImGuiWidgets is inspired by the following projects:

License

ImGuiWidgets is licensed under the MIT License. See LICENSE for more information.

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 is compatible.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.6.5-pre.17 0 5/21/2025
1.6.5-pre.16 31 5/20/2025
1.6.2-pre.2 44 4/26/2025
1.6.2-pre.1 106 4/4/2025
1.6.1 378 3/30/2025
1.6.0 217 3/30/2025
1.5.2 84 3/29/2025
1.5.2-pre.1 66 3/29/2025
1.5.1 108 3/28/2025
1.5.1-pre.1 443 3/25/2025
1.5.0 185 3/17/2025
1.4.1-pre.4 125 3/11/2025
1.4.1-pre.3 161 3/5/2025
1.4.1-pre.2 61 2/19/2025
1.4.1-pre.1 67 2/17/2025
1.4.0 269 2/14/2025
1.3.1 103 2/14/2025
1.3.0 123 2/12/2025
1.2.2-pre.1 57 2/6/2025
1.2.1 131 2/6/2025
1.2.0 91 2/6/2025
1.1.5-pre.1 65 2/6/2025
1.1.4 103 2/5/2025
1.1.4-pre.1 52 2/5/2025
1.1.3 87 2/5/2025
1.1.2 94 2/5/2025
1.1.1 110 2/3/2025
1.1.1-pre.21 58 2/4/2025
1.1.1-pre.20 53 2/4/2025
1.1.1-pre.19 60 2/3/2025
1.1.1-pre.18 53 2/3/2025
1.1.1-pre.17 51 2/3/2025
1.1.1-pre.16 57 2/2/2025
1.1.1-pre.15 55 1/31/2025
1.1.1-pre.14 50 1/29/2025
1.1.1-pre.13 53 1/27/2025
1.1.1-pre.12 49 1/25/2025
1.1.1-pre.11 52 1/23/2025
1.1.1-pre.10 53 1/21/2025
1.1.1-pre.9 56 1/20/2025
1.1.1-pre.8 51 1/19/2025
1.1.1-pre.7 49 1/17/2025
1.1.1-pre.6 45 1/15/2025
1.1.1-pre.5 30 1/14/2025
1.1.1-pre.4 46 1/13/2025
1.1.1-pre.3 54 1/11/2025
1.1.1-pre.2 48 1/10/2025
1.1.1-pre.1 47 1/8/2025
1.1.0 230 1/5/2025
1.0.15 113 12/27/2024
1.0.15-pre.9 70 1/4/2025
1.0.15-pre.8 57 1/3/2025
1.0.15-pre.7 60 1/3/2025
1.0.15-pre.6 60 1/3/2025
1.0.15-pre.5 62 1/1/2025
1.0.15-pre.4 74 12/31/2024
1.0.15-pre.3 56 12/29/2024
1.0.15-pre.2 48 12/28/2024
1.0.15-pre.1 54 12/27/2024
1.0.14-pre.1 51 12/27/2024
1.0.13 94 12/26/2024
1.0.12 96 12/26/2024
1.0.11 97 12/25/2024
1.0.10 96 12/24/2024
1.0.10-pre.1 49 12/27/2024
1.0.9 97 12/23/2024
1.0.8 84 12/23/2024
1.0.7 96 12/22/2024
1.0.6 84 12/22/2024
1.0.5 93 12/22/2024
1.0.4 104 12/22/2024
1.0.3 100 12/19/2024
1.0.2 100 12/19/2024
1.0.1 87 12/19/2024
1.0.0 93 12/19/2024
1.0.0-alpha.116 64 12/18/2024
1.0.0-alpha.115 154 12/17/2024
1.0.0-alpha.114 83 12/14/2024
1.0.0-alpha.113 77 12/13/2024
1.0.0-alpha.112 71 12/12/2024
1.0.0-alpha.111 79 12/11/2024
1.0.0-alpha.110 77 12/10/2024
1.0.0-alpha.109 83 12/7/2024
1.0.0-alpha.108 61 12/6/2024
1.0.0-alpha.107 83 12/5/2024
1.0.0-alpha.106 84 12/2/2024
1.0.0-alpha.105 49 12/2/2024
1.0.0-alpha.104 52 12/2/2024
1.0.0-alpha.103 52 12/2/2024
1.0.0-alpha.102 61 12/2/2024
1.0.0-alpha.101 53 12/2/2024
1.0.0-alpha.100 74 12/1/2024
1.0.0-alpha.99 59 12/1/2024
1.0.0-alpha.98 59 12/1/2024
1.0.0-alpha.97 55 11/30/2024
1.0.0-alpha.96 61 11/30/2024
1.0.0-alpha.95 68 11/29/2024
1.0.0-alpha.94 75 11/28/2024
1.0.0-alpha.93 74 11/26/2024
1.0.0-alpha.92 63 11/26/2024
1.0.0-alpha.91 77 11/23/2024
1.0.0-alpha.90 76 11/22/2024
1.0.0-alpha.89 73 11/21/2024
1.0.0-alpha.88 81 11/20/2024
1.0.0-alpha.87 59 11/19/2024
1.0.0-alpha.86 57 11/16/2024
1.0.0-alpha.85 56 11/15/2024
1.0.0-alpha.84 59 11/14/2024
1.0.0-alpha.83 64 11/13/2024
1.0.0-alpha.82 61 11/12/2024
1.0.0-alpha.81 75 11/9/2024
1.0.0-alpha.80 56 11/8/2024
1.0.0-alpha.79 61 11/7/2024
1.0.0-alpha.78 54 11/6/2024
1.0.0-alpha.77 71 11/5/2024
1.0.0-alpha.76 227 11/2/2024
1.0.0-alpha.75 56 11/1/2024
1.0.0-alpha.74 129 10/30/2024
1.0.0-alpha.73 65 10/26/2024
1.0.0-alpha.72 67 10/23/2024
1.0.0-alpha.71 61 10/22/2024
1.0.0-alpha.70 86 10/19/2024
1.0.0-alpha.69 83 10/18/2024
1.0.0-alpha.68 83 10/17/2024
1.0.0-alpha.67 64 10/16/2024
1.0.0-alpha.66 63 10/15/2024
1.0.0-alpha.65 73 10/12/2024
1.0.0-alpha.64 58 10/11/2024
1.0.0-alpha.63 67 10/10/2024
1.0.0-alpha.62 70 10/8/2024
1.0.0-alpha.61 67 10/5/2024
1.0.0-alpha.60 56 10/4/2024
1.0.0-alpha.59 186 9/30/2024
1.0.0-alpha.58 124 9/30/2024
1.0.0-alpha.57 90 9/30/2024
1.0.0-alpha.56 60 9/30/2024
1.0.0-alpha.55 67 9/30/2024
1.0.0-alpha.54 64 9/28/2024
1.0.0-alpha.53 56 9/27/2024
1.0.0-alpha.52 70 9/26/2024
1.0.0-alpha.51 71 9/25/2024
1.0.0-alpha.50 78 9/24/2024
1.0.0-alpha.49 69 9/23/2024
1.0.0-alpha.48 71 9/21/2024
1.0.0-alpha.47 68 9/19/2024
1.0.0-alpha.46 59 9/19/2024
1.0.0-alpha.45 52 9/19/2024
1.0.0-alpha.44 67 9/19/2024
1.0.0-alpha.43 111 9/18/2024
1.0.0-alpha.42 60 9/18/2024
1.0.0-alpha.41 61 9/18/2024
1.0.0-alpha.40 56 9/18/2024
1.0.0-alpha.39 75 9/18/2024
1.0.0-alpha.38 92 9/14/2024
1.0.0-alpha.37 67 9/14/2024

## v1.6.5-pre.16

Initial release or repository with no prior history.