IMFB is a cross-platform, modern C++ file browser widget for Dear ImGui. It provides a customizable, efficient, and easy-to-integrate file selection dialog for desktop applications.
- Cross-platform: Windows, Linux, macOS
- Modern C++ (C++23)
- Multiple selection, directory selection, filter support
- Customizable flags and appearance
- Example integration with SFML3
- CMake >= 3.25
- C++23 compatible compiler (MSVC, Clang, GCC, AppleClang)
- Dear ImGui
- (Optional) SFML3 for example
git clone https://github.com/Life4gal/imgui-file-browser.git
cd imgui-file-browser
# Configure with CMake
cmake -B build -S . -DCMAKE_TOOLCHAIN_FILE="C:/workspace/vcpkg/scripts/buildsystems/vcpkg.cmake" cmake --build build
Include the header and link the library:
#include <imgui-file_browser.hpp>
auto main() noexcept -> int
{
ImGui::FileBrowser file_browser{"FileBrowser"};
file_browser.set_flags(
// ImGui::FileBrowserFlags::NO_MODAL,
ImGui::FileBrowserFlags::CLOSE_ON_ESCAPE,
ImGui::FileBrowserFlags::CONFIRM_ON_ENTER,
ImGui::FileBrowserFlags::MULTIPLE_SELECTION,
ImGui::FileBrowserFlags::PATH_EDITABLE
);
file_browser.set_filter({".hpp", ".cpp", ".dll"});
while (main_loop())
{
// Process event
// ...
// Update
// ...
ImGui::Begin("IMFB");
{
if (ImGui::Button("Open FileBrowser"))
{
file_browser.open();
}
}
ImGui::End();
file_browser.show();
if (file_browser.has_selected())
{
auto selected = file_browser.get_selected();
// Use selected file
// ...
}
// Render
// ...
}
}
See example/SFML3/main.cpp
for a full integration example.
This project is licensed under the ISC License.