Corex.Tree.Item
(Corex v0.1.0-beta.5)
View Source
Tree item structure.
Use it to create hierarchical/nested structures for:
Fields
:value- (optional) Unique node value, auto-generated if not provided:label- (required) Display text:to- (optional) Destination (path or URL) used by navigation components:children- (optional) Nested items (list of maps):disabled- (optional) Whether the item is disabled:group- (optional) Group identifier for grouping items:meta- (optional) Additional metadata for the item:redirect- (optional) Per-item navigation mode::href(default, full page redirect),:patch(LiveViewjs().patch, same mount),:navigate(LiveViewjs().navigate, another mount in the samelive_session), orfalseto disable redirect for this item. The hook never inspects the URL to guess the mode; it only executes what is declared here.:new_tab- (optional) Open the item's destination in a new tab viawindow.open(mode is ignored whentrue)
Examples
Corex.Tree.Item.new(%{label: "File", children: [%{label: "New"}, %{label: "Open"}]})
Summary
Types
Functions
Creates a single Tree.Item from a map, auto-generating a :value if not provided
and recursively processing :children.
Map keys must not include :id; use :value for node identity.
Raises ArgumentError if attrs is not a map or is missing required fields,
or if a child is neither a map nor a Tree.Item struct.