FolderSelector#
- class ansys.solutions.dash_super_components.FolderSelector(mode: FolderSelectorMode | None = None, aio_id: str | None = None, browse_button_props: dict[str, Any] | None = None, clear_button_props: dict[str, Any] | None = None, style: dict[str, Any] | None = None, options: dict[str, Any] | None = None, value: str | None = None)#
Bases:
DivA Dash component for browsing and selecting a directory.
FolderSelector is based on the Dash All-in-One (AIO) component pattern. It supports two operating modes:
Tkinter (
FolderSelectorMode.TKINTER): native OS dialog; requires thetkinterpackage.Bootstrap (
FolderSelectorMode.BOOTSTRAP): browser-based modal with a tree view of the file system; works in headless or remote environments.
Bootstrap mode is a beta feature and is disabled by default. Applications can opt in by calling
configure()withenable_beta_features=True.When
modeis not specified, and bootstrap beta is enabled, bootstrap is used whentkinteris unavailable or when the environment variableFOLDER_SELECTOR_REMOTE_DEPLOYMENTis set totrue,1, oryes; otherwise tkinter is used.Note
The component must be placed inside a
MantineProvider. For error notifications to work correctly, admc.NotificationContainermust also be present in the application layout. By default the container ID is"notification-container"; useconfigure()to change it.- Parameters:
- mode
FolderSelectorMode,optional Operating mode. Use
FolderSelectorMode.TKINTERfor a native OS dialog orFolderSelectorMode.BOOTSTRAPfor a browser-based modal. Bootstrap mode is available only whenconfigure()was called withenable_beta_features=True. When omitted, the mode is selected automatically (see above).- aio_id
str,optional Unique identifier for this component instance. A UUID is generated when not provided.
- browse_button_props
dict,optional Properties forwarded to the browse
dmc.Button.- clear_button_props
dict,optional Properties forwarded to the clear
dmc.ActionIcon.- style
dict,optional CSS style properties applied to the component container.
- options
dict,optional Additional configuration options:
default_path(str or pathlib.Path, optional): Path used as the default selected folder when nothing has been selected or the selection is cleared.browse_from(str, optional): Root path for the file tree in Bootstrapmode. In Bootstrap mode, this value must be provided either via this option or via the
FOLDER_SELECTOR_BROWSE_FROMenvironment variable.
topmost(bool, optional): IfTrue, the tkinter dialog appears in the foreground. Default isTrue.max_path_length(int, optional): Maximum allowed path length. Defaults to the system limit.max_tree_depth(int, optional): Maximum folder depth to include in bootstrap mode. Default is10.max_children_per_node(int, optional): Maximum number of childfolders included per tree node in Bootstrap mode. Default is
100.
display_field(dict, optional): Dict with anenabledkey (bool) controlling whether the selected path is shown below the buttons, and an optionalmax_display_lineskey (int) controlling how many lines the path text may span before being truncated with an ellipsis. When the path is truncated, hovering over the display field shows the full path in a tooltip. Default is{"enabled": True, "max_display_lines": 2}.
- value
str,optional Preselected folder path. Populates the selected folder store upon component instantiation.
- mode
IDs
- class ansys.solutions.dash_super_components.FolderSelector.FolderSelectorIds#
Bases:
AIOIdsProvides IDs for the subcomponents of
FolderSelector.- classmethod browse_button(aio_id: str | Wildcard) dict[str, Any]#
Return the ID for the browse button.