FileBrowser
File/directory browser at the server side.
@solara.component
def FileBrowser(
directory: Union[None, str, Path, solara.Reactive[Path]] = None,
on_directory_change: Optional[Callable[[Path], None]] = None,
on_path_select: Optional[Callable[[Optional[Path]], None]] = None,
on_file_open: Optional[Callable[[Path], None]] = None,
filter: Callable[[Path], bool] = lambda x: True,
directory_first: bool = False,
on_file_name: Optional[Callable[[str], None]] = None,
start_directory=None,
can_select=False,
):
...
There are two modes possible
can_select=False
on_file_open
: Triggered when single clicking a file or directory.on_path_select
: Never triggeredon_directory_change
: Triggered when clicking a directorycan_select=True
on_file_open
: Triggered when double clicking a file or directory.on_path_select
: Triggered when clicking a file or directoryon_directory_change
: Triggered when double clicking a directory
Arguments
directory
: The directory to start in. IfNone
the current working directory is used.on_directory_change
: Depends on mode, see above.on_path_select
: Depends on mode, see above.on_file_open
: Depends on mode, see above.filter
: A function that takes aPath
and returnsTrue
if the file/directory should be shown.directory_first
: IfTrue
directories are shown before files. Default:False
.on_file_name
: (deprecated) Use on_file_open instead.start_directory
: (deprecated) Use directory instead.
Example
/home/runner
..
factory
perflog
runners
warmup
work
You are in directory: /home/runner
You selected path: None
You opened file: None