ktsu.ImGui.Popups 2.2.11
ImGuiPopups
A comprehensive library for custom popup windows and modal dialogs using ImGui.NET, providing a rich set of UI components for interactive applications.
Features
🪟 Modal Windows
- Modal: Base modal window with customizable content and size
- MessageOK: Simple message dialog with OK button
- Prompt: Customizable prompt with multiple button options
📝 Input Components
- InputString: Text input popup with validation
- InputInt: Integer input popup with numeric validation
- InputFloat: Floating-point input popup with numeric validation
🔍 Selection Components
- SearchableList: Searchable dropdown list with filtering capabilities
- FilesystemBrowser: Advanced file/directory browser with:
- Open and Save modes
- File and Directory targeting
- Pattern filtering support
- Navigation breadcrumbs
✨ Key Features
- Responsive Design: All popups adapt to content and custom sizing
- Keyboard Navigation: Full keyboard support with proper focus management
- Validation: Built-in input validation and error handling
- Customizable: Flexible styling and layout options
- Type-Safe: Generic components with strong typing
Installation
Package Manager Console
Install-Package ktsu.ImGuiPopups
.NET CLI
dotnet add package ktsu.ImGuiPopups
PackageReference
<PackageReference Include="ktsu.ImGuiPopups" Version="1.3.5" />
Quick Start
using ktsu.ImGuiPopups;
// Create popup instances (typically as class members)
private static readonly ImGuiPopups.MessageOK messageOK = new();
private static readonly ImGuiPopups.InputString inputString = new();
private static readonly ImGuiPopups.SearchableList<string> searchableList = new();
// In your ImGui render loop
private void OnRender()
{
// Show a simple message
if (ImGui.Button("Show Message"))
{
messageOK.Open("Information", "Hello, World!");
}
// Get text input from user
if (ImGui.Button("Get Input"))
{
inputString.Open("Enter Name", "Name:", "Default Name",
result => Console.WriteLine($"User entered: {result}"));
}
// Show searchable selection
if (ImGui.Button("Select Item"))
{
var items = new[] { "Apple", "Banana", "Cherry", "Date" };
searchableList.Open("Select Fruit", "Choose:", items, null,
item => item, // Text converter
selected => Console.WriteLine($"Selected: {selected}"),
Vector2.Zero);
}
// Render all popups (call this once per frame)
messageOK.ShowIfOpen();
inputString.ShowIfOpen();
searchableList.ShowIfOpen();
}
Component Documentation
MessageOK
Simple message dialog with an OK button.
var messageOK = new ImGuiPopups.MessageOK();
messageOK.Open("Title", "Your message here");
Input Components
Get validated input from users:
// String input
var inputString = new ImGuiPopups.InputString();
inputString.Open("Enter Text", "Label:", "default", result => HandleString(result));
// Integer input
var inputInt = new ImGuiPopups.InputInt();
inputInt.Open("Enter Number", "Value:", 42, result => HandleInt(result));
// Float input
var inputFloat = new ImGuiPopups.InputFloat();
inputFloat.Open("Enter Float", "Value:", 3.14f, result => HandleFloat(result));
SearchableList
Searchable selection from a list of items:
var searchableList = new ImGuiPopups.SearchableList<MyClass>();
searchableList.Open(
title: "Select Item",
label: "Choose an item:",
items: myItemList,
defaultItem: null,
getText: item => item.DisplayName, // How to display items
onConfirm: selected => HandleSelection(selected),
customSize: new Vector2(400, 300)
);
FilesystemBrowser
Advanced file and directory browser:
var browser = new ImGuiPopups.FilesystemBrowser();
// Open file
browser.Open(
title: "Open File",
mode: FilesystemBrowserMode.Open,
target: FilesystemBrowserTarget.File,
startPath: Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments),
onConfirm: path => OpenFile(path),
patterns: new[] { "*.txt", "*.md" } // Optional file filters
);
// Save file
browser.Open(
title: "Save File",
mode: FilesystemBrowserMode.Save,
target: FilesystemBrowserTarget.File,
startPath: currentDirectory,
onConfirm: path => SaveFile(path)
);
Custom Modal
Create custom modal dialogs:
var customModal = new ImGuiPopups.Modal();
customModal.Open("Custom Dialog", () => {
ImGui.Text("Custom content here");
if (ImGui.Button("Close"))
{
ImGui.CloseCurrentPopup();
}
}, new Vector2(300, 200));
Advanced Usage
Custom Sizing
All popups support custom sizing:
// Fixed size
popup.Open("Title", "Content", new Vector2(400, 300));
// Auto-size (Vector2.Zero)
popup.Open("Title", "Content", Vector2.Zero);
Text Layout Options
Prompts support different text layout modes:
var prompt = new ImGuiPopups.Prompt();
prompt.Open("Title", "Long message text here...",
buttons: new() { { "OK", null }, { "Cancel", null } },
textLayoutType: PromptTextLayoutType.Wrapped, // or Unformatted
size: new Vector2(400, 200)
);
Validation and Error Handling
Input components provide built-in validation:
inputInt.Open("Enter Age", "Age (1-120):", 25, result => {
if (result < 1 || result > 120)
{
messageOK.Open("Error", "Age must be between 1 and 120");
return;
}
ProcessAge(result);
});
Demo Application
The repository includes a comprehensive demo application showcasing all components:
git clone https://github.com/ktsu-dev/ImGuiPopups.git
cd ImGuiPopups
dotnet run --project ImGuiPopupsDemo
Dependencies
- Hexa.NET.ImGui - ImGui.NET bindings
- ktsu.Extensions - Utility extensions
- ktsu.CaseConverter - String case conversion
- ktsu.ScopedAction - RAII-style actions
- ktsu.StrongPaths - Type-safe path handling
- ktsu.TextFilter - Text filtering utilities
- Microsoft.Extensions.FileSystemGlobbing - File pattern matching
Contributing
Contributions are welcome! Please feel free to submit a Pull Request. For major changes, please open an issue first to discuss what you would like to change.
License
This project is licensed under the MIT License - see the LICENSE.md file for details.
Changelog
See CHANGELOG.md for a detailed history of changes.
ktsu.dev - Building tools for developers
Showing the top 20 packages that depend on ktsu.ImGui.Popups.
| Packages | Downloads |
|---|---|
|
ktsu.ImGui.Styler
Package Description
|
150 |
|
ktsu.ImGui.Styler
Package Description
|
147 |
|
ktsu.ImGui.Styler
Package Description
|
145 |
|
ktsu.ImGui.Styler
Package Description
|
143 |
|
ktsu.ImGui.Styler
Package Description
|
142 |
|
ktsu.ImGui.Styler
Package Description
|
89 |
|
ktsu.ImGui.Styler
Package Description
|
61 |
|
ktsu.ImGui.Styler
Package Description
|
60 |
|
ktsu.ImGui.Styler
Package Description
|
59 |
|
ktsu.ImGui.Styler
A library for expressively styling ImGui.NET interfaces.
|
59 |
|
ktsu.ImGui.Styler
Package Description
|
58 |
|
ktsu.ImGui.Styler
A library for expressively styling ImGui.NET interfaces.
|
58 |
|
ktsu.ImGui.Styler
Package Description
|
57 |
|
ktsu.ImGui.Styler
A library for expressively styling ImGui.NET interfaces.
|
57 |
|
ktsu.ImGui.Styler
Package Description
|
56 |
.NET 8.0
- Hexa.NET.ImGui (>= 2.2.9)
- Microsoft.Extensions.FileSystemGlobbing (>= 10.0.2)
- Microsoft.SourceLink.AzureRepos.Git (>= 10.0.102)
- Microsoft.SourceLink.GitHub (>= 10.0.102)
- Polyfill (>= 9.7.6)
- ktsu.CaseConverter (>= 1.3.6)
- ktsu.Extensions (>= 1.5.9)
- ktsu.ScopedAction (>= 1.1.6)
- ktsu.Semantics.Strings (>= 1.0.28)
- ktsu.TextFilter (>= 1.5.4)
- ktsu.Semantics.Paths (>= 1.0.28)
.NET 10.0
- ktsu.TextFilter (>= 1.5.4)
- ktsu.Semantics.Strings (>= 1.0.28)
- ktsu.Semantics.Paths (>= 1.0.28)
- ktsu.ScopedAction (>= 1.1.6)
- ktsu.Extensions (>= 1.5.9)
- ktsu.CaseConverter (>= 1.3.6)
- Polyfill (>= 9.7.6)
- Microsoft.SourceLink.GitHub (>= 10.0.102)
- Microsoft.SourceLink.AzureRepos.Git (>= 10.0.102)
- Microsoft.Extensions.FileSystemGlobbing (>= 10.0.2)
- Hexa.NET.ImGui (>= 2.2.9)
.NET 9.0
- ktsu.TextFilter (>= 1.5.4)
- ktsu.Semantics.Strings (>= 1.0.28)
- ktsu.Semantics.Paths (>= 1.0.28)
- ktsu.Extensions (>= 1.5.9)
- ktsu.ScopedAction (>= 1.1.6)
- Polyfill (>= 9.7.6)
- ktsu.CaseConverter (>= 1.3.6)
- Hexa.NET.ImGui (>= 2.2.9)
- Microsoft.Extensions.FileSystemGlobbing (>= 10.0.2)
- Microsoft.SourceLink.AzureRepos.Git (>= 10.0.102)
- Microsoft.SourceLink.GitHub (>= 10.0.102)
| Version | Downloads | Last updated |
|---|---|---|
| 2.3.3 | 13 | 02/14/2026 |
| 2.3.2 | 13 | 02/14/2026 |
| 2.3.1 | 55 | 02/10/2026 |
| 2.3.0 | 54 | 02/10/2026 |
| 2.2.12-pre.1 | 54 | 02/10/2026 |
| 2.2.11 | 54 | 02/10/2026 |
| 2.2.11-pre.2 | 56 | 02/06/2026 |
| 2.2.11-pre.1 | 54 | 02/05/2026 |
| 2.2.10 | 55 | 02/03/2026 |
| 2.2.10-pre.2 | 54 | 02/01/2026 |
| 2.2.10-pre.1 | 56 | 01/31/2026 |
| 2.2.9 | 56 | 01/31/2026 |
| 2.2.9-pre.2 | 56 | 01/31/2026 |
| 2.2.9-pre.1 | 53 | 01/31/2026 |
| 2.2.8 | 57 | 01/31/2026 |
| 2.2.7 | 56 | 01/30/2026 |
| 2.2.6 | 55 | 01/29/2026 |
| 2.2.5 | 57 | 01/29/2026 |
| 2.2.4 | 56 | 01/29/2026 |
| 2.2.3 | 59 | 01/27/2026 |
| 2.2.2 | 58 | 01/27/2026 |
| 2.2.1 | 87 | 01/09/2026 |
| 2.2.1-pre.1 | 142 | 11/24/2025 |
| 2.2.0 | 143 | 11/23/2025 |
| 2.1.10 | 139 | 11/23/2025 |
| 2.1.10-pre.2 | 140 | 11/23/2025 |
| 2.1.10-pre.1 | 141 | 11/19/2025 |
| 2.1.9 | 142 | 09/09/2025 |
| 2.1.8 | 149 | 09/08/2025 |