ktsu.ImGui.Popups 3.80.0

Prefix Reserved
There is a newer prerelease version of this package available.
See the version list below for details.
dotnet add package ktsu.ImGui.Popups --version 3.80.0
                    
NuGet\Install-Package ktsu.ImGui.Popups -Version 3.80.0
                    
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.ImGui.Popups" Version="3.80.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="ktsu.ImGui.Popups" Version="3.80.0" />
                    
Directory.Packages.props
<PackageReference Include="ktsu.ImGui.Popups" />
                    
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.ImGui.Popups --version 3.80.0
                    
#r "nuget: ktsu.ImGui.Popups, 3.80.0"
                    
#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.
#:package ktsu.ImGui.Popups@3.80.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=ktsu.ImGui.Popups&version=3.80.0
                    
Install as a Cake Addin
#tool nuget:?package=ktsu.ImGui.Popups&version=3.80.0
                    
Install as a Cake Tool

ktsu.ImGui.Popups

NuGet License

A comprehensive library for custom popup windows and modal dialogs for Dear ImGui, built on the Hexa.NET.ImGui bindings, 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
    • Back, forward and up, and a breadcrumb path you can click to type a path
    • A sidebar of your own places, the user's folders, recent folders and drives
    • Search, hidden files, and a new folder button
    • A sortable table (name, size, modified) or a grid of thumbnails you supply

✨ 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.ImGui.Popups

.NET CLI

dotnet add package ktsu.ImGui.Popups

PackageReference

<PackageReference Include="ktsu.ImGui.Popups" Version="x.y.z" />

Quick Start

using ktsu.ImGui.Popups;

// 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 a file (the optional glob filters which files are shown)
browser.FileOpen("Open File", path => OpenFile(path), glob: "*.txt");

// Save a file
browser.FileSave("Save File", path => SaveFile(path), glob: "*.txt");

// Choose a directory
browser.ChooseDirectory("Select Folder", dir => UseDirectory(dir));

// Render the browser each frame in your ImGui loop
browser.ShowIfOpen();

Set ConfirmOverwrite = true and a save that picks a file that already exists asks "Replace it?" first. Replace chooses the file and closes the browser; Cancel, Escape or closing the question leave the browser open where it was. It is off by default, so an application that confirms replacements itself does not ask twice.

The browser has a toolbar (back, forward, up, refresh, a breadcrumb path and a search box), a sidebar of places, recent folders and drives, and a footer with New Folder, Hidden files, the view choice and the confirm buttons. Clicking the empty part of the path, or Ctrl+L, turns it into a text box: a folder typed there is opened, and a file is chosen. Alt+Left, Alt+Right, Alt+Up (or Backspace), F5 and Enter do what they do in a file manager.

Thumbnails come from you, since this package uploads no textures. Set ThumbnailResolver and the grid view, and a preview of the selected file in the sidebar, draw what it returns:

browser.ThumbnailResolver = file =>
    thumbnailCache.TryGet(file, out Texture texture)
        ? new ImGuiPopups.FilesystemBrowserThumbnail(texture.Id, new Vector2(texture.Width, texture.Height))
        : null; // still being made, or not a picture: the tile shows the extension

It is called for each file tile on screen, every frame, so look the picture up rather than decoding the file there. Other settings:

Member What it does
View FilesystemBrowserView.List (the default) or Thumbnails; the browser keeps whichever the user picked
ThumbnailSize The thumbnail edge in pixels at 100% scale, 96 by default; the user changes it with a slider
ShowHiddenFiles Lists hidden files and folders; off by default
Places Your own folders, listed above the user's home, desktop, documents, pictures and downloads
RecentFolders Folders something was chosen in, most recent first; fill it on start and save it on exit to keep it
NavigateTo(folder) Shows a folder, now or when the browser next opens
Directory The folder being shown

A folder chooser with no folder selected chooses the folder being shown.

File callbacks receive an AbsoluteFilePath and directory callbacks an AbsoluteDirectoryPath (from ktsu.Semantics.Paths). Each FileOpen/FileSave/ChooseDirectory overload also accepts a Vector2 customSize.

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)
);

Buttons with their own probe names, a checkbox, and a dismiss answer

PromptButton gives each button its own probe name, and marks at most one as the cancel answer. A modal can close without any button being clicked: by Escape, by its close button, or because ImGui closed it when another popup opened at the same level. Whoever asked is still waiting then, so the cancel button's action runs, once, as if it had been clicked. Every action runs after the popup has ended, so an answer can open the next prompt. A PromptCheckbox draws a checkbox above the buttons, read through Checked from inside an action.

var prompt = new ImGuiPopups.Prompt();
prompt.Open("Unsaved Changes", "Save changes before closing?",
[
    new ImGuiPopups.PromptButton("Save", () => Save(rememberChoice: prompt.Checked), "unsaved/save"),
    new ImGuiPopups.PromptButton("Don't Save", Close, "unsaved/discard"),
    new ImGuiPopups.PromptButton("Cancel", KeepOpen, "unsaved/cancel", IsCancel: true),
],
new ImGuiPopups.PromptCheckbox("Don't ask again", "unsaved/remember"));

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/ImGuiApp.git
cd ImGuiApp
dotnet run --project examples/ImGuiPopupsDemo

Dependencies

Changelog

See CHANGELOG.md for a detailed history of changes.


ktsu.dev - Building tools for developers

Acknowledgments

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.

License

ImGui.Popups is licensed under the MIT License. See LICENSE.md 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 is compatible.  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 (2)

Showing the top 2 NuGet packages that depend on ktsu.ImGui.Popups:

Package Downloads
ktsu.ImGui.Styler

A powerful styling library for ImGui.NET interfaces featuring 50+ built-in themes (Catppuccin, Tokyo Night, Gruvbox, Dracula, Nord, and more), interactive theme browser, scoped styling system for colors and style variables, advanced color manipulation with hex support and accessibility features, automatic content alignment and centering, semantic text colors, button alignment, and indentation utilities.

ktsu.ImGuiCredentialPopups

A .NET library providing ready-made Dear ImGui modal dialogs for collecting credentials. Ships username/password and token popups built on a shared CredentialPopup base, with masked input, automatic keyboard focus, and confirmation callbacks that hand back a ktsu.CredentialCache credential ready to store or use.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
3.80.1-pre.1 65 11/17/2026
3.80.0 706 11/10/2026
3.79.1-pre.3 89 10/28/2026
3.79.1-pre.2 88 10/27/2026
3.79.1-pre.1 82 10/26/2026
3.79.0 743 10/26/2026
3.78.3 211 10/25/2026
3.78.2 320 10/24/2026
3.78.1 187 10/24/2026
3.78.0 249 10/22/2026
3.77.3 234 10/21/2026
3.77.2 215 10/21/2026
3.77.1 210 10/21/2026
3.77.0 193 10/20/2026
3.76.1 209 10/20/2026
3.76.0 196 10/20/2026
3.75.4 846 10/19/2026
3.75.3 301 10/18/2026
3.75.2 251 10/17/2026
3.75.2-pre.1 93 10/16/2026
Loading failed

## v3.80.0 (minor)

Changes since v3.79.0:

- Add a SessionStart hook for Claude Code cloud sessions (#713) (matt-edmondson)
- Use Path.Join for the temporary PNG path in PngEncoderTests (Claude)
- [minor] Move image decoding into ktsu.Imaging (Claude)
- Read C++ raw string literals as one string [minor] (#742) (matt-edmondson)
- Read HTML script and style bodies as text up to their closing tag [minor] (#741) (matt-edmondson)
- Keep a backslashed quote inside a Python raw string [minor] (#740) (matt-edmondson)