A tree is a list of nested rows that open and close. Tree reads its rows from a model and reports what the user
does to them.
The model keeps each row’s open and current state in an atom.
Wrap your app in RegistryProvider from @effect/atom-react. This is best practice, because your app then controls
the registry that the tree reads. Without a provider, the tree reads the library’s default registry.
Each part handles keyboard navigation and the current and selected states. Each part also sets its own spacing, so put
the tree in a panel’s body with no padding around it.
Provides a React context that supplies the AtomRegistry used by Atom hooks and
hydration helpers, defaulting to a standalone registry when no provider is
present.
When to use
Use to supply an existing AtomRegistry through React context when hooks or
hydration helpers need to share registry state that is managed outside
RegistryProvider.
@see ― RegistryProvider for creating and providing a registry for a React subtree
functionuseContext<T>(context: React.Context<T>): T
Accepts a context object (the value returned from React.createContext) and returns the current
context value, as given by the nearest context provider for the given context.
Hierarchical list on Ark's tree-view, driven by TreeModel atoms, with Ark's part names on the Next row vocabulary:
Root (model, virtual, animate, activation policy, drag and drop), Label, Content (the scrolling tree
element; a row renderer as children), Item (one row), ItemIndicator (caret), ItemIcon, ItemText,
ItemCount, ItemActions (trailing controls shown on the row in play), ItemGroup/ItemGroupLabel (section
headers) and Empty.
Tree's only entry point is five atom families, which is the right shape for a store that is
already reactive per node (ECHO, a live app graph) but roughly a hundred lines of plumbing for a
caller that just holds an array — the cost that kept ObjectsTree, ProcessTree and the stories
on hand-rolled renderers instead. Open/current state is owned here, keyed by path, so the same
node appearing at two paths stays independent.
Accepts a context object (the value returned from React.createContext) and returns the current
context value, as given by the nearest context provider for the given context.
Provides a React context that supplies the AtomRegistry used by Atom hooks and
hydration helpers, defaulting to a standalone registry when no provider is
present.
When to use
Use to supply an existing AtomRegistry through React context when hooks or
hydration helpers need to share registry state that is managed outside
RegistryProvider.
@see ― RegistryProvider for creating and providing a registry for a React subtree
Tree's only entry point is five atom families, which is the right shape for a store that is
already reactive per node (ECHO, a live app graph) but roughly a hundred lines of plumbing for a
caller that just holds an array — the cost that kept ObjectsTree, ProcessTree and the stories
on hand-rolled renderers instead. Open/current state is owned here, keyed by path, so the same
node appearing at two paths stays independent.
Hierarchical list on Ark's tree-view, driven by TreeModel atoms, with Ark's part names on the Next row vocabulary:
Root (model, virtual, animate, activation policy, drag and drop), Label, Content (the scrolling tree
element; a row renderer as children), Item (one row), ItemIndicator (caret), ItemIcon, ItemText,
ItemCount, ItemActions (trailing controls shown on the row in play), ItemGroup/ItemGroupLabel (section
headers) and Empty.
A row activation (click, Enter, or the machine's selection). Option-click on a branch toggles it instead, and a
click on the current row reports it again (the machine emits nothing for it).
onSelect={
const handleSelect: ({ path, current }: TreeSelectEvent<Folder>) =>void
Hierarchical list on Ark's tree-view, driven by TreeModel atoms, with Ark's part names on the Next row vocabulary:
Root (model, virtual, animate, activation policy, drag and drop), Label, Content (the scrolling tree
element; a row renderer as children), Item (one row), ItemIndicator (caret), ItemIcon, ItemText,
ItemCount, ItemActions (trailing controls shown on the row in play), ItemGroup/ItemGroupLabel (section
headers) and Empty.
Hierarchical list on Ark's tree-view, driven by TreeModel atoms, with Ark's part names on the Next row vocabulary:
Root (model, virtual, animate, activation policy, drag and drop), Label, Content (the scrolling tree
element; a row renderer as children), Item (one row), ItemIndicator (caret), ItemIcon, ItemText,
ItemCount, ItemActions (trailing controls shown on the row in play), ItemGroup/ItemGroupLabel (section
headers) and Empty.
Hierarchical list on Ark's tree-view, driven by TreeModel atoms, with Ark's part names on the Next row vocabulary:
Root (model, virtual, animate, activation policy, drag and drop), Label, Content (the scrolling tree
element; a row renderer as children), Item (one row), ItemIndicator (caret), ItemIcon, ItemText,
ItemCount, ItemActions (trailing controls shown on the row in play), ItemGroup/ItemGroupLabel (section
headers) and Empty.
Hierarchical list on Ark's tree-view, driven by TreeModel atoms, with Ark's part names on the Next row vocabulary:
Root (model, virtual, animate, activation policy, drag and drop), Label, Content (the scrolling tree
element; a row renderer as children), Item (one row), ItemIndicator (caret), ItemIcon, ItemText,
ItemCount, ItemActions (trailing controls shown on the row in play), ItemGroup/ItemGroupLabel (section
headers) and Empty.
Text whose first line is centred in a block, so it lines up with a Block or control beside it however many lines
it wraps to. Renders a <p>; asChild puts the metrics on a heading or other text element instead.
Text
tone?: Typography.TextTone | undefined
Emphasis below the default (DESIGN.md "Text emphasis"): description for secondary content, subdued for
interface text.
Text whose first line is centred in a block, so it lines up with a Block or control beside it however many lines
it wraps to. Renders a <p>; asChild puts the metrics on a heading or other text element instead.
Text>
61
</>
62
);
63
};
64
getChildren returns a folder’s items, and getProps gives each row its label and icon. handleOpenChange and
handleSelect write open and current to the atom that model.stateAtom returns for the row’s path.
A tree over App Graph, such as Composer’s navigation, gets its model from the graph instead.