Currently, the TreeView will only render the node.text (string). It could be useful to override the display value and/or provide custom styles.
This PR makes the node slottable.
The most basic usage is to access the metadata via the let:node directive and override the default slot.
<TreeView children="{children}" let:node>
{node.id}
{node.text}
{node.expanded}
{node.selected}
{node.disabled}
{node.leaf} // True if the node is a leaf (node does not have children)
</TreeView>
The node metadata can be used to conditionally apply logic/styles:
Closes #1660
Currently, the
TreeView
will only render thenode.text
(string). It could be useful to override the display value and/or provide custom styles.This PR makes the
node
slottable.The most basic usage is to access the metadata via the
let:node
directive and override the default slot.The
node
metadata can be used to conditionally apply logic/styles:The code example above produces the following: