pub struct FileExplorer<A = ()> { /* private fields */ }Expand description
Snapshot-backed, URI-identified filesystem tree with editing and context menus.
Input snapshots are recursively sorted directory-first on each build and
projected into an intent-only TreeView. The widget emits actions but does
not mutate a filesystem. Default rendering is non-virtualized and vertically
scrollable. A is the surrounding application’s action type.
§Examples
use ailloli_ui_fs::FileUri;
use ailloli_ui_widgets::files::{FileExplorer, FileExplorerNode};
let nodes = [FileExplorerNode::directory(FileUri::parse("file:///repo")?, "repo")];
let explorer = FileExplorer::<()>::new(nodes);
let _ = explorer;Implementations§
Source§impl<A: 'static> FileExplorer<A>
impl<A: 'static> FileExplorer<A>
Sourcepub fn height(self, value: impl Into<Length>) -> Self
pub fn height(self, value: impl Into<Length>) -> Self
Sets preferred height from a logical-pixel or length value.
§Examples
use ailloli_ui_widgets::layout::Container;
let widget: Container<()> = Container::new().height(40.0);
let _ = widget;Sourcepub fn min_width(self, value: impl Into<Length>) -> Self
pub fn min_width(self, value: impl Into<Length>) -> Self
Sets the minimum width bound.
§Examples
use ailloli_ui_widgets::layout::Container;
let widget: Container<()> = Container::new().min_width(40.0);
let _ = widget;Sourcepub fn max_width(self, value: impl Into<Length>) -> Self
pub fn max_width(self, value: impl Into<Length>) -> Self
Sets the maximum width bound.
§Examples
use ailloli_ui_widgets::layout::Container;
let widget: Container<()> = Container::new().max_width(320.0);
let _ = widget;Sourcepub fn min_height(self, value: impl Into<Length>) -> Self
pub fn min_height(self, value: impl Into<Length>) -> Self
Sets the minimum height bound.
§Examples
use ailloli_ui_widgets::layout::Container;
let widget: Container<()> = Container::new().min_height(24.0);
let _ = widget;Sourcepub fn max_height(self, value: impl Into<Length>) -> Self
pub fn max_height(self, value: impl Into<Length>) -> Self
Sets the maximum height bound.
§Examples
use ailloli_ui_widgets::layout::Container;
let widget: Container<()> = Container::new().max_height(240.0);
let _ = widget;Sourcepub fn fill(self) -> Self
pub fn fill(self) -> Self
Sets both preferred axes to parent fill.
§Examples
use ailloli_ui_widgets::layout::Container;
let widget: Container<()> = Container::new().fill();
let _ = widget;Sourcepub fn fill_width(self) -> Self
pub fn fill_width(self) -> Self
Sets preferred width to parent fill.
§Examples
use ailloli_ui_widgets::layout::Container;
let widget: Container<()> = Container::new().fill_width();
let _ = widget;Sourcepub fn fill_height(self) -> Self
pub fn fill_height(self) -> Self
Sets preferred height to parent fill.
§Examples
use ailloli_ui_widgets::layout::Container;
let widget: Container<()> = Container::new().fill_height();
let _ = widget;Sourcepub fn margin(self, value: f32) -> Self
pub fn margin(self, value: f32) -> Self
Sets uniform outer margin in logical pixels.
§Examples
use ailloli_ui_widgets::layout::Container;
let widget: Container<()> = Container::new().margin(8.0);
let _ = widget;Sourcepub fn padding(self, value: f32) -> Self
pub fn padding(self, value: f32) -> Self
Sets uniform inner padding in logical pixels.
§Examples
use ailloli_ui_widgets::layout::Container;
let widget: Container<()> = Container::new().padding(8.0);
let _ = widget;Sourcepub fn flex_grow(self) -> Self
pub fn flex_grow(self) -> Self
Sets flex-grow weight to one.
§Examples
use ailloli_ui_widgets::layout::Container;
let widget: Container<()> = Container::new().flex_grow();
let _ = widget;Sourcepub fn flex_grow_by(self, value: f32) -> Self
pub fn flex_grow_by(self, value: f32) -> Self
Sets a dimensionless flex-grow weight.
§Examples
use ailloli_ui_widgets::layout::Container;
let widget: Container<()> = Container::new().flex_grow_by(2.0);
let _ = widget;Sourcepub fn flex_shrink(self, value: f32) -> Self
pub fn flex_shrink(self, value: f32) -> Self
Sets a dimensionless flex-shrink weight.
§Examples
use ailloli_ui_widgets::layout::Container;
let widget: Container<()> = Container::new().flex_shrink(1.0);
let _ = widget;Sourcepub fn flex_basis(self, value: impl Into<Length>) -> Self
pub fn flex_basis(self, value: impl Into<Length>) -> Self
Sets the preferred main-axis flex basis.
§Examples
use ailloli_ui_widgets::layout::Container;
let widget: Container<()> = Container::new().flex_basis(80.0);
let _ = widget;Sourcepub fn align_self(self, value: AlignItems) -> Self
pub fn align_self(self, value: AlignItems) -> Self
Overrides cross-axis alignment for this flex item.
§Examples
use ailloli_ui_core::style::AlignItems;
use ailloli_ui_widgets::layout::Container;
let widget: Container<()> = Container::new().align_self(AlignItems::Center);
let _ = widget;Source§impl<A: 'static> FileExplorer<A>
impl<A: 'static> FileExplorer<A>
Sourcepub fn new(nodes: impl IntoIterator<Item = FileExplorerNode>) -> Self
pub fn new(nodes: impl IntoIterator<Item = FileExplorerNode>) -> Self
Collects a static recursive snapshot with default interaction/style state.
Input order is not retained during rendering: sibling nodes are sorted recursively. Duplicate URIs are accepted but make identity ambiguous.
§Examples
use ailloli_ui_fs::FileUri;
use ailloli_ui_widgets::files::{FileExplorer, FileExplorerNode};
let explorer = FileExplorer::<()>::new([
FileExplorerNode::file(FileUri::parse("file:///a")?, "a"),
]);
let _ = explorer;Sourcepub fn bind_nodes(self, nodes: impl Into<Signal<Vec<FileExplorerNode>>>) -> Self
pub fn bind_nodes(self, nodes: impl Into<Signal<Vec<FileExplorerNode>>>) -> Self
Binds the recursive snapshot to live shared state.
Bound nodes take precedence over constructor nodes. Each build reads, clones, and recursively sorts the current vector.
§Examples
use ailloli_ui_runtime::component::State;
use ailloli_ui_widgets::files::{FileExplorer, FileExplorerNode};
let explorer = FileExplorer::<()>::default().bind_nodes(State::new(Vec::<FileExplorerNode>::new()));
let _ = explorer;Sourcepub fn selected(self, selected: impl Into<Binding<FileUri>>) -> Self
pub fn selected(self, selected: impl Into<Binding<FileUri>>) -> Self
Sets static/generic selected-URI input and clears writable selection state.
User selection still emits callbacks, but only Self::bind_selected
installs the writable signal that the inner tree updates automatically.
§Examples
use ailloli_ui_fs::FileUri;
use ailloli_ui_widgets::files::FileExplorer;
let explorer = FileExplorer::<()>::default().selected(FileUri::parse("file:///a")?);
let _ = explorer;Sourcepub fn bind_selected(self, selected: impl Into<Signal<FileUri>>) -> Self
pub fn bind_selected(self, selected: impl Into<Signal<FileUri>>) -> Self
Binds selection to writable shared state.
The inner tree writes the URI on user selection before callbacks.
§Examples
use ailloli_ui_fs::FileUri;
use ailloli_ui_runtime::component::State;
use ailloli_ui_widgets::files::FileExplorer;
let selected = State::new(FileUri::parse("file:///a")?);
let explorer = FileExplorer::<()>::default().bind_selected(selected);
let _ = explorer;Sourcepub fn expanded(self, expanded: impl Into<Binding<Vec<FileUri>>>) -> Self
pub fn expanded(self, expanded: impl Into<Binding<Vec<FileUri>>>) -> Self
Sets static/generic expanded URIs and clears writable expansion state.
This input takes precedence over default expansion. Only a signal installed
by Self::bind_expanded is automatically written on toggles.
§Examples
use ailloli_ui_fs::FileUri;
use ailloli_ui_widgets::files::FileExplorer;
let explorer = FileExplorer::<()>::default().expanded(vec![FileUri::parse("file:///repo")?]);
let _ = explorer;Sourcepub fn bind_expanded(self, expanded: impl Into<Signal<Vec<FileUri>>>) -> Self
pub fn bind_expanded(self, expanded: impl Into<Signal<Vec<FileUri>>>) -> Self
Binds expansion to writable shared state.
§Examples
use ailloli_ui_fs::FileUri;
use ailloli_ui_runtime::component::State;
use ailloli_ui_widgets::files::FileExplorer;
let expanded = State::new(vec![FileUri::parse("file:///repo")?]);
let explorer = FileExplorer::<()>::default().bind_expanded(expanded);
let _ = explorer;Sourcepub fn default_expanded(self, uri: FileUri) -> Self
pub fn default_expanded(self, uri: FileUri) -> Self
Appends one unique initial expansion URI.
Defaults apply only when neither Self::expanded nor
Self::bind_expanded supplies controlled state.
§Examples
use ailloli_ui_fs::FileUri;
use ailloli_ui_widgets::files::FileExplorer;
let explorer = FileExplorer::<()>::default().default_expanded(FileUri::parse("file:///repo")?);
let _ = explorer;Sourcepub fn default_expanded_many(
self,
uris: impl IntoIterator<Item = FileUri>,
) -> Self
pub fn default_expanded_many( self, uris: impl IntoIterator<Item = FileUri>, ) -> Self
Replaces initial expansion URIs, preserving first-occurrence order.
§Examples
use ailloli_ui_fs::FileUri;
use ailloli_ui_widgets::files::FileExplorer;
let root = FileUri::parse("file:///repo")?;
let explorer = FileExplorer::<()>::default().default_expanded_many([root.clone(), root]);
let _ = explorer;Sourcepub fn disabled(self, disabled: impl Into<Binding<bool>>) -> Self
pub fn disabled(self, disabled: impl Into<Binding<bool>>) -> Self
Binds whether tree interaction is disabled.
§Examples
use ailloli_ui_runtime::component::State;
use ailloli_ui_widgets::files::FileExplorer;
let explorer = FileExplorer::<()>::default().disabled(State::new(true));
let _ = explorer;Sourcepub fn clipboard_can_paste(self, can_paste: impl Into<Binding<bool>>) -> Self
pub fn clipboard_can_paste(self, can_paste: impl Into<Binding<bool>>) -> Self
Binds whether keyboard/blank-area paste actions are eligible.
A row context menu can still emit PasteInto when an aggregate action
handler exists; this flag primarily gates shortcuts and blank menus.
§Examples
use ailloli_ui_widgets::files::FileExplorer;
let explorer = FileExplorer::<()>::default().clipboard_can_paste(true);
let _ = explorer;Sourcepub fn file_style(self, style: FileExplorerStyle) -> Self
pub fn file_style(self, style: FileExplorerStyle) -> Self
Replaces the complete tree style.
§Examples
use ailloli_ui_widgets::files::{FileExplorer, FileExplorerStyle};
let explorer = FileExplorer::<()>::default().file_style(FileExplorerStyle::default());
let _ = explorer;Sourcepub fn file_size(self, size: FileExplorerSize) -> Self
pub fn file_size(self, size: FileExplorerSize) -> Self
Applies a density preset using the default theme.
This replaces the entire existing style.
§Examples
use ailloli_ui_widgets::files::{FileExplorer, FileExplorerSize};
let explorer = FileExplorer::<()>::default().file_size(FileExplorerSize::Compact);
let _ = explorer;Sourcepub fn virtualized(self, virtualized: bool) -> Self
pub fn virtualized(self, virtualized: bool) -> Self
Enables viewport-driven row virtualization in the inner tree.
The default is false; this changes rendering work, not snapshot contents.
§Examples
use ailloli_ui_widgets::files::FileExplorer;
let explorer = FileExplorer::<()>::default().virtualized(true);
let _ = explorer;Sourcepub fn scrollable(self, scrollable: bool) -> Self
pub fn scrollable(self, scrollable: bool) -> Self
Wraps the tree in a vertical ScrollView when true.
Scrolling is enabled by default. When disabled, explorer layout builders apply directly to the tree.
§Examples
use ailloli_ui_widgets::files::FileExplorer;
let explorer = FileExplorer::<()>::default().scrollable(false);
let _ = explorer;Sourcepub fn on_action(self, f: impl Fn(FileExplorerAction) -> A + 'static) -> Self
pub fn on_action(self, f: impl Fn(FileExplorerAction) -> A + 'static) -> Self
Maps the complete explorer action stream into application actions.
Specialized callbacks run first for their committed interaction, so both may dispatch for one event.
§Examples
use ailloli_ui_widgets::files::{FileExplorer, FileExplorerAction};
enum Action { Explorer(FileExplorerAction) }
let explorer = FileExplorer::<Action>::default().on_action(Action::Explorer);
let _ = explorer;Sourcepub fn on_action_ctx(
self,
f: impl Fn(&mut EventCtx<A>, FileExplorerAction) + 'static,
) -> Self
pub fn on_action_ctx( self, f: impl Fn(&mut EventCtx<A>, FileExplorerAction) + 'static, ) -> Self
Handles the complete action stream with direct event-context access.
§Examples
use ailloli_ui_widgets::files::FileExplorer;
let explorer = FileExplorer::<()>::default().on_action_ctx(|_ctx, _action| {});
let _ = explorer;Sourcepub fn on_select(self, f: impl Fn(FileUri) -> A + 'static) -> Self
pub fn on_select(self, f: impl Fn(FileUri) -> A + 'static) -> Self
Maps row selection into an application action before aggregate emission.
§Examples
use ailloli_ui_fs::FileUri;
use ailloli_ui_widgets::files::FileExplorer;
enum Action { Select(FileUri) }
let explorer = FileExplorer::<Action>::default().on_select(Action::Select);
let _ = explorer;Sourcepub fn on_select_ctx(
self,
f: impl Fn(&mut EventCtx<A>, FileUri) + 'static,
) -> Self
pub fn on_select_ctx( self, f: impl Fn(&mut EventCtx<A>, FileUri) + 'static, ) -> Self
Handles row selection with direct event-context access.
§Examples
use ailloli_ui_widgets::files::FileExplorer;
let explorer = FileExplorer::<()>::default().on_select_ctx(|_ctx, _uri| {});
let _ = explorer;Sourcepub fn on_open(self, f: impl Fn(FileUri) -> A + 'static) -> Self
pub fn on_open(self, f: impl Fn(FileUri) -> A + 'static) -> Self
Maps leaf/context-menu activation before aggregate Open emission.
§Examples
use ailloli_ui_fs::FileUri;
use ailloli_ui_widgets::files::FileExplorer;
enum Action { Open(FileUri) }
let explorer = FileExplorer::<Action>::default().on_open(Action::Open);
let _ = explorer;Sourcepub fn on_open_ctx(
self,
f: impl Fn(&mut EventCtx<A>, FileUri) + 'static,
) -> Self
pub fn on_open_ctx( self, f: impl Fn(&mut EventCtx<A>, FileUri) + 'static, ) -> Self
Handles leaf/context-menu activation with event-context access.
§Examples
use ailloli_ui_widgets::files::FileExplorer;
let explorer = FileExplorer::<()>::default().on_open_ctx(|_ctx, _uri| {});
let _ = explorer;Sourcepub fn on_toggle(self, f: impl Fn(FileUri, bool) -> A + 'static) -> Self
pub fn on_toggle(self, f: impl Fn(FileUri, bool) -> A + 'static) -> Self
Maps branch URI/new-state transitions before aggregate emission.
§Examples
use ailloli_ui_fs::FileUri;
use ailloli_ui_widgets::files::FileExplorer;
enum Action { Toggle(FileUri, bool) }
let explorer = FileExplorer::<Action>::default().on_toggle(Action::Toggle);
let _ = explorer;Sourcepub fn on_toggle_ctx(
self,
f: impl Fn(&mut EventCtx<A>, FileUri, bool) + 'static,
) -> Self
pub fn on_toggle_ctx( self, f: impl Fn(&mut EventCtx<A>, FileUri, bool) + 'static, ) -> Self
Handles branch expansion transitions with event-context access.
§Examples
use ailloli_ui_widgets::files::FileExplorer;
let explorer = FileExplorer::<()>::default().on_toggle_ctx(|_ctx, _uri, _open| {});
let _ = explorer;Sourcepub fn on_rename(self, f: impl Fn(FileExplorerRename) -> A + 'static) -> Self
pub fn on_rename(self, f: impl Fn(FileExplorerRename) -> A + 'static) -> Self
Maps committed inline renames before aggregate Rename emission.
Context-menu rename requests begin editing and emit RenameRequested but
do not call this handler until editing commits.
§Examples
use ailloli_ui_widgets::files::{FileExplorer, FileExplorerRename};
enum Action { Rename(FileExplorerRename) }
let explorer = FileExplorer::<Action>::default().on_rename(Action::Rename);
let _ = explorer;Sourcepub fn on_rename_ctx(
self,
f: impl Fn(&mut EventCtx<A>, FileExplorerRename) + 'static,
) -> Self
pub fn on_rename_ctx( self, f: impl Fn(&mut EventCtx<A>, FileExplorerRename) + 'static, ) -> Self
Handles committed inline renames with event-context access.
§Examples
use ailloli_ui_widgets::files::FileExplorer;
let explorer = FileExplorer::<()>::default().on_rename_ctx(|_ctx, _rename| {});
let _ = explorer;Sourcepub fn on_remove(
self,
f: impl Fn(FileUri, Option<FileUri>) -> A + 'static,
) -> Self
pub fn on_remove( self, f: impl Fn(FileUri, Option<FileUri>) -> A + 'static, ) -> Self
Maps committed tree delete events before aggregate Remove emission.
Context-menu delete emits RemoveRequested through the aggregate handler;
it uses this handler only to enable the item and does not call it directly.
§Examples
use ailloli_ui_fs::FileUri;
use ailloli_ui_widgets::files::FileExplorer;
enum Action { Remove(FileUri, Option<FileUri>) }
let explorer = FileExplorer::<Action>::default().on_remove(Action::Remove);
let _ = explorer;Sourcepub fn on_remove_ctx(
self,
f: impl Fn(&mut EventCtx<A>, FileUri, Option<FileUri>) + 'static,
) -> Self
pub fn on_remove_ctx( self, f: impl Fn(&mut EventCtx<A>, FileUri, Option<FileUri>) + 'static, ) -> Self
Handles committed tree delete events with event-context access.
§Examples
use ailloli_ui_widgets::files::FileExplorer;
let explorer = FileExplorer::<()>::default().on_remove_ctx(|_ctx, _uri, _parent| {});
let _ = explorer;Sourcepub fn on_create_dir(
self,
f: impl Fn(FileExplorerCreateDir) -> A + 'static,
) -> Self
pub fn on_create_dir( self, f: impl Fn(FileExplorerCreateDir) -> A + 'static, ) -> Self
Maps committed directory drafts before aggregate CreateDir emission.
File drafts have no specialized callback and emit only aggregate
FileExplorerAction::CreateFile.
§Examples
use ailloli_ui_widgets::files::{FileExplorer, FileExplorerCreateDir};
enum Action { Create(FileExplorerCreateDir) }
let explorer = FileExplorer::<Action>::default().on_create_dir(Action::Create);
let _ = explorer;Sourcepub fn on_create_dir_ctx(
self,
f: impl Fn(&mut EventCtx<A>, FileExplorerCreateDir) + 'static,
) -> Self
pub fn on_create_dir_ctx( self, f: impl Fn(&mut EventCtx<A>, FileExplorerCreateDir) + 'static, ) -> Self
Handles committed directory drafts with event-context access.
§Examples
use ailloli_ui_widgets::files::FileExplorer;
let explorer = FileExplorer::<()>::default().on_create_dir_ctx(|_ctx, _event| {});
let _ = explorer;Trait Implementations§
Source§impl<A: 'static> Default for FileExplorer<A>
Creates an empty enabled explorer through Self::new.
impl<A: 'static> Default for FileExplorer<A>
Creates an empty enabled explorer through Self::new.
Source§impl<A: 'static> IntoView<A> for FileExplorer<A>
Converts the builder into an intent-only tree, optional scroll view, and menu.
impl<A: 'static> IntoView<A> for FileExplorer<A>
Converts the builder into an intent-only tree, optional scroll view, and menu.