Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Trees

The tree components browse a folder hierarchy. They are canary extras: Streamlit has no equivalent.

There are four panels, all built on the same row and selection engine:

ComponentShape
SingleTreeSelectOne folder at a time; .. walks up
TreeViewEvery level in one listing over a static data model
FileTreeViewThe same classic tree, rooted on a real folder
DualTreeSelectTwo columns: subfolders left, files right
ColumnViewFinder-style stack of columns, one level per column

On top of the panels there are path inputs:

ComponentShape
PathInputA text box that resolves its text into a path
PathSelectPathInput plus a navigation ladder
PathInputBrowseA path box paired with one of the panels

Shared selection modes

The single-list, classic, and file trees share three modes:

  • 'single': one node;
  • 'multiple': several nodes within the folder being browsed; leaving the folder drops them;
  • 'multicross': nodes gathered across folders into a bucket.

A tuple of modes, such as ('single', 'multicross'), shows a mode switch. selection_mode decides which modes are offered; initial_mode decides which one opens.

DualTreeSelect and ColumnView are single-select only.

Shared row gestures

  • Clicking a row picks or ticks it.
  • Hovering a folder reveals an -> arrow; clicking it walks into the folder.
  • The .. row walks up. Its checkbox is frozen because it is a navigation target, not a node.

Filtering

filter keeps files by suffix:

sc.FileTreeView(filter='.py')
sc.FileTreeView(filter=('.py', '.pyi'))

Folders are always listed.

Pages