| Crates.io | dear-file-browser |
| lib.rs | dear-file-browser |
| version | 0.8.0 |
| created_at | 2025-10-04 16:46:25.665081+00 |
| updated_at | 2026-01-02 18:17:33.196658+00 |
| description | File dialogs and in-UI file browser for dear-imgui-rs |
| homepage | https://github.com/Latias94/dear-imgui-rs |
| repository | https://github.com/Latias94/dear-imgui-rs |
| max_upload_size | |
| id | 1868263 |
| size | 128,606 |
File dialogs and in-UI file browser for dear-imgui-rs with two backends:
rfd): OS dialogs on desktop, Web File Picker on WASM
| Item | Version |
|---|---|
| Crate | 0.8.x |
| dear-imgui-rs | 0.8.x |
Backend::Auto|Native|ImGui with runtime selectionOpenFile, OpenFiles, PickFolder, SaveFileStandard (quick locations + list) or MinimalSelect or NavigateSelection + FileDialogError across backendstracing instrumentationimgui (default): enable the in-UI file browsernative-rfd (default): enable native dialogs via rfdtracing (default): enable internal tracing spansDefault enables both backends; at runtime Backend::Auto prefers native and
falls back to ImGui if not available.
use dear_file_browser::{Backend, DialogMode, FileDialog};
// Native async dialog (desktop/wasm):
# #[cfg(feature = "native-rfd")]
let selection = pollster::block_on(
FileDialog::new(DialogMode::OpenFiles)
.backend(Backend::Auto)
.filter(("Images", &["png", "jpg"]))
.open_async()
);
// ImGui-embedded browser (non-blocking):
# use dear_imgui_rs::*;
# let mut ctx = Context::create();
# let ui = ctx.frame();
use dear_file_browser::{FileBrowserState, FileDialogExt};
let mut state = FileBrowserState::new(DialogMode::OpenFile);
// Optional configuration
state.layout = LayoutStyle::Standard; // or Minimal
state.click_action = ClickAction::Select; // or Navigate
state.double_click = true;
state.dirs_first = true;
state.breadcrumbs_max_segments = 6;
state.empty_hint_enabled = true;
state.empty_hint_color = [0.7, 0.7, 0.7, 1.0];
ui.window("Open")
.size([600.0, 420.0], dear_imgui_rs::Condition::FirstUseEver)
.build(|| {
if let Some(res) = ui.file_browser().show(&mut state) {
match res {
Ok(sel) => {
for p in sel.paths { println!("{:?}", p); }
}
Err(e) => eprintln!("dialog: {e}"),
}
}
});
rfd uses the browser file picker and is the recommended way to access user files.std::fs to enumerate directories. In the browser this cannot access the OS filesystem, so the view will be empty. Prefer the native rfd backend on wasm.Dear ImGui’s default font does not include CJK glyphs or emoji. If your filesystem contains non‑ASCII names (e.g., Chinese), load a font with the required glyphs into the atlas during initialization. See examples/style_and_fonts.rs for a complete pattern. Enabling the freetype feature in dear-imgui-rs also improves text quality.
MIT OR Apache-2.0