Skip to content

feat: add multiple file browser selection#1162

Open
maartenbreddels wants to merge 1 commit into
masterfrom
codex/file-browser-multiple
Open

feat: add multiple file browser selection#1162
maartenbreddels wants to merge 1 commit into
masterfrom
codex/file-browser-multiple

Conversation

@maartenbreddels

@maartenbreddels maartenbreddels commented Jun 2, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Refactor FileBrowser around a reusable internal base while preserving single-selection behavior and string-directory compatibility.
  • Add FileBrowserMultiple for Path-only multiple selection with optimistic row highlighting and selected-row ripple handling.
  • Update the website docs demo/API docs and add focused tests, including a generic fake filesystem source.

Usage snippets

Single file selection keeps the existing FileBrowser API:

from pathlib import Path
from typing import Optional, cast

import solara

selected_file = solara.reactive(cast(Optional[Path], None))
solara.FileBrowser(Path.cwd(), selected=selected_file)

Multiple file selection uses FileBrowserMultiple and Path values:

from pathlib import Path
from typing import List, cast

import solara

selected_files = solara.reactive(cast(List[Path], []))
solara.FileBrowserMultiple(Path.cwd(), selected=selected_files)

Callback style also receives Path values:

from pathlib import Path
from typing import List

import solara


def on_select(paths: List[Path]):
    print(paths)


solara.FileBrowserMultiple(Path.cwd(), on_paths_select=on_select)

Demo

  • Video demo: selecting report.csv and notes.txt, toggling report.csv, and clearing the remaining selection.
filebrowser-multiple-pr-demo.mp4

Tests

  • uv run pytest tests/unit/file_browser_test.py::test_file_browser_callback_can_select tests/unit/file_browser_test.py::test_file_browser_relative_path tests/unit/file_browser_test.py::test_file_browser_programmatic_select tests/unit/file_browser_test.py::test_file_browser_multiple_callback_select tests/unit/file_browser_test.py::test_file_browser_multiple_programmatic_select tests/unit/file_browser_test.py::test_file_browser_multiple_open_and_navigate_clear_selection tests/unit/file_browser_test.py::test_file_browser_multiple_does_not_select_parent tests/unit/file_browser_test.py::test_file_browser_multiple_requires_path_directory tests/unit/file_browser_test.py::test_file_browser_base_supports_generic_source -q
  • Commit hooks: passed on the squashed commit

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant