{"id":51854177,"url":"https://github.com/beyondlex/ratatui-finder","last_synced_at":"2026-07-23T23:02:08.454Z","repository":{"id":371300075,"uuid":"1299879474","full_name":"beyondlex/ratatui-finder","owner":"beyondlex","description":null,"archived":false,"fork":false,"pushed_at":"2026-07-14T10:24:29.000Z","size":54,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-07-14T12:21:40.000Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/beyondlex.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-07-14T01:21:44.000Z","updated_at":"2026-07-14T10:24:33.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/beyondlex/ratatui-finder","commit_stats":null,"previous_names":["beyondlex/ratatui-finder"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/beyondlex/ratatui-finder","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/beyondlex%2Fratatui-finder","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/beyondlex%2Fratatui-finder/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/beyondlex%2Fratatui-finder/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/beyondlex%2Fratatui-finder/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/beyondlex","download_url":"https://codeload.github.com/beyondlex/ratatui-finder/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/beyondlex%2Fratatui-finder/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":35819442,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-07-20T02:08:10.276Z","status":"online","status_checked_at":"2026-07-23T02:00:06.683Z","response_time":57,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2026-07-23T23:02:07.752Z","updated_at":"2026-07-23T23:02:08.447Z","avatar_url":"https://github.com/beyondlex.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ratatui-finder\n\nA macOS Finder-style \"Go to Path\" directory navigation component for [ratatui](https://ratatui.rs) TUI applications.\n\n![ratatui-finder](https://github.com/beyondlex/images/blob/main/ratatui-finder.png)\n\n## Features\n\n- **Interactive path browser** — type a path, get instant listings and fuzzy-matched results\n- **Three modes**: listing (`/`-ending), auto-listing (existing directory), matching (partial name)\n- **Fuzzy matching** with first-character filter and `*`-wildcard substring search\n- **Tab completion** — autocomplete the selected item name\n- **Parent navigation** — `Ctrl-w` jumps to parent directory\n- **Customizable colors** — override any color in the UI\n- **Customizable key bindings** — rebind all actions to your preferred keys\n- **Rounded or straight borders** — configurable `BorderType` (Rounded, Plain, Double, Thick)\n- **Custom title** — set your own popup title text\n- **Smart path entry** — directory paths auto-append `/` on initialization\n- **Fully self-contained** — no dependency on any framework, just pure data structures + `Widget` rendering\n\n## Quick Start\n\n```toml\n[dependencies]\nratatui-finder = \"0.5.0\"\ncrossterm = \"0.28\"\n```\n\n```rust\nuse crossterm::event::{self, Event, DisableBracketedPaste, EnableBracketedPaste};\nuse ratatui_finder::{FinderState, FinderConfig, FinderAction, render_finder_popup};\n\nlet mut state = FinderState::new(FinderConfig::default());\n\n// In your setup:\nexecute!(stdout, EnableBracketedPaste)?;\n\n// In your event loop:\nloop {\n    match event::read()? {\n        Event::Key(key) =\u003e match state.handle_key(key) {\n            FinderAction::Confirm(path) =\u003e { /* use path */ break; }\n            FinderAction::Cancel =\u003e break,\n            FinderAction::Redraw =\u003e {}\n            _ =\u003e {}\n        },\n        Event::Paste(text) =\u003e state.handle_paste(\u0026text),\n        _ =\u003e {}\n    }\n}\n\n// In your render function:\nrender_finder_popup(f, f.area(), \u0026mut state);\n\n// On cleanup:\nexecute!(stdout, DisableBracketedPaste)?;\n```\n\nA runnable demo is available:\n\n```sh\ncargo run --example demo\n```\n\n## Default Key Bindings\n\n| Key | Action |\n|---|---|\n| Character input | Append to input, refresh results |\n| `Enter` | Confirm selected path |\n| `Esc` / `Ctrl-c` | Cancel |\n| `Tab` | Complete selected item name |\n| `Up` / `Down` or `Ctrl-p` / `Ctrl-n` | Navigate results |\n| `Ctrl-w` or `Option+Backspace` | Go to parent directory |\n| `Ctrl-u` | Clear input |\n| `Home` / `End` or `Ctrl-a` / `Ctrl-e` | Cursor to start/end |\n| `Left` / `Right` | Move cursor |\n| `Option+Left` | Move cursor left by one word |\n| `Option+Right` | Move cursor right by one word |\n| `Backspace` / `Delete` | Delete character |\n\nAll key bindings are configurable via `FinderKeys` — see [Customization](#customization).\n\n## API\n\n### Types\n\n- **`FinderState`** — main state machine holding input, cursor, results, and config\n- **`FinderConfig`** — configuration: `mode`, `initial_path`, `extensions`, `colors`, `keys`, `border_type`, `title`\n- **`FinderMode`** — filter mode: `Dir`, `File`, `Both`\n- **`FinderAction`** — feedback to host: `None`, `Confirm(String)`, `Cancel`, `Redraw`\n- **`FinderItem`** — a result item with match positions for highlighting\n- **`FinderColors`** — color configuration for all UI elements\n- **`FinderKeys`** — key binding configuration for all actions\n- **`KeyBinding`** — a single key binding (code + modifiers)\n\n### Methods\n\n| Method | Returns | Description |\n|---|---|---|\n| `FinderState::new(config)` | `Self` | Create a new instance |\n| `state.handle_key(key)` | `FinderAction` | Process a key event from your event loop |\n| `state.handle_paste(text)` | — | Paste text at cursor (single refresh). Wire to `Event::Paste` |\n| `state.word_left()` | — | Move cursor left by one word (bound to `Alt+b` / `Esc b`) |\n| `state.word_right()` | — | Move cursor right by one word (bound to `Alt+f` / `Esc f`) |\n| `state.refresh()` | — | Force refresh the results list |\n| `render_finder_popup(f, area, \u0026mut state)` | — | Render the finder popup in a ratatui frame |\n\n### Integration Pattern\n\nThe finder is a pure state machine — it renders via ratatui and returns actions via `handle_key`.\nNo callbacks, no channels. Typical integration:\n\n1. Create `FinderState` with your config\n2. In your event loop, pass `Event::Key` to `state.handle_key()`\n3. Match the returned `FinderAction`:\n   - `Confirm(path)` — user selected or typed a path\n   - `Cancel` — user dismissed the popup\n   - `Redraw` — state changed, render again\n   - `None` — unhandled key, you can process it further\n4. In your render pass, call `render_finder_popup(f, area, \u0026mut state)`\n\n### Paste Support\n\nEnable bracketed paste mode on the terminal so that pasted text arrives as a single `Event::Paste` instead of many individual key events:\n\n```rust\nuse crossterm::event::{EnableBracketedPaste, DisableBracketedPaste};\n\n// After entering raw mode:\nexecute!(stdout, EnableBracketedPaste)?;\n\n// In your event loop:\nEvent::Paste(text) =\u003e state.handle_paste(\u0026text),\n\n// On cleanup:\nexecute!(stdout, DisableBracketedPaste)?;\n```\n\n## Customization\n\n### Colors\n\nOverride any color by setting `FinderColors` on `FinderConfig`:\n\n```rust\nuse ratatui_finder::{FinderColors, FinderConfig, FinderMode, FinderState};\nuse ratatui::style::Color;\n\nlet config = FinderConfig {\n    mode: FinderMode::Dir,\n    colors: FinderColors {\n        selected_bg: Color::Blue,\n        match_fg: Color::Cyan,\n        hint_fg: Color::Gray,\n        ..Default::default()\n    },\n    ..Default::default()\n};\n\nlet state = FinderState::new(config);\n```\n\nAll color fields and their defaults:\n\n| Field          | Default | Purpose                                  |\n|----------------|---|------------------------------------------|\n| `input_fg`     | `White` | Input text                               |\n| `input_bg`     | `Black` | Input background                         |\n| `hint_fg`      | `Cyan` | Tab completion hint                      |\n| `hint_bg`      | `Black` | Hint background                          |\n| `selected_bg`  | `Blue` | Selected result row background           |\n| `selected_fg`  | `White` | Selected result row text                 |\n| `normal_bg`    | `Black` | Unselected result row background         |\n| `normal_fg`    | `White` | Unselected result row text               |\n| `match_fg`     | `Green` | Highlighted match characters             |\n| `border_fg`    | `White` | Popup border                             |\n| `border_bg`    | `Black` | Popup border background                  |\n| `separator_fg` | `DarkGray` | Separator line between input and results |\n| `title_fg`     | `Gray` | Title text                               |\n\n### Key Bindings\n\nOverride any key binding by setting `FinderKeys` on `FinderConfig`:\n\n```rust\nuse crossterm::event::{KeyCode, KeyModifiers};\nuse ratatui_finder::{FinderKeys, KeyBinding, FinderConfig, FinderState};\n\nlet config = FinderConfig {\n    keys: FinderKeys {\n        confirm: vec![\n            KeyBinding::new(KeyCode::Enter, KeyModifiers::NONE),\n            KeyBinding::new(KeyCode::Char('o'), KeyModifiers::CONTROL),\n        ],\n        cancel: vec![KeyBinding::new(KeyCode::Char('q'), KeyModifiers::NONE)],\n        cursor_up: vec![KeyBinding::new(KeyCode::Up, KeyModifiers::NONE)],\n        cursor_down: vec![KeyBinding::new(KeyCode::Down, KeyModifiers::NONE)],\n        ..Default::default()\n    },\n    ..Default::default()\n};\n\nlet state = FinderState::new(config);\n```\n\nEach field is a `Vec\u003cKeyBinding\u003e` — multiple keys can map to the same action.\nUnbound actions use defaults. Character input always falls through for any `Char` key not caught by a configured binding.\n\nAvailable action fields:\n\n| Field | Default | Action |\n|---|---|---|\n| `confirm` | `Enter` | Confirm selected path |\n| `cancel` | `Esc`, `Ctrl-c` | Cancel |\n| `tab_complete` | `Tab` | Complete selected item name |\n| `cursor_up` | `Up`, `Ctrl-p` | Move selection up |\n| `cursor_down` | `Down`, `Ctrl-n` | Move selection down |\n| `home` | `Home`, `Ctrl-a` | Cursor to start |\n| `end` | `End`, `Ctrl-e` | Cursor to end |\n| `cursor_left` | `Left` | Move cursor left |\n| `cursor_right` | `Right` | Move cursor right |\n| `backspace` | `Backspace` | Delete character before cursor |\n| `delete` | `Delete` | Delete character after cursor |\n| `parent_dir` | `Ctrl-w` | Go to parent directory |\n| `clear_input` | `Ctrl-u` | Clear input |\n\n### Border \u0026 Title\n\nCustomize the popup border style and title:\n\n```rust\nuse ratatui::widgets::BorderType;\nuse ratatui_finder::{FinderConfig, FinderState};\n\nlet config = FinderConfig {\n    title: \" Navigate \".to_string(),\n    border_type: BorderType::Plain,\n    ..Default::default()\n};\n\nlet state = FinderState::new(config);\n```\n\n| Field | Default | Options |\n|---|---|---|\n| `title` | `\" Go to: \"` | Any string |\n| `title_fg` | `Gray` | Title text color (set on `FinderColors`) |\n| `border_type` | `BorderType::Rounded` | `Plain`, `Rounded`, `Double`, `Thick`, `QuadrantInside`, `QuadrantOutside` |\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbeyondlex%2Fratatui-finder","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbeyondlex%2Fratatui-finder","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbeyondlex%2Fratatui-finder/lists"}