<!-- Generated by npm run gen:skill from ui/Tree/skill.md - do not edit. -->

# Tree

## `<tree>`

- `virtual`: auto | true | false
- `selection`: none | single | multi
- `open-on`: enter | dblclick | click
- `sort`: ascending | descending
- `filter-mode`: hide | dim
- `cascade`: down | none
- `item-height`, `hide-root`, `root-select`, `loading-label`, `state`, `deselect`, `sort-by`, `checkboxes`, `draggable`, `droppable`, `accept`, `upload`, `upload-folders`, `upload-accept`
- bound state, `attr="{xpath}"` into the `state` document: `expanded`, `checked`, `selected`, `selected-xpath`, `focused`, `path`, `reveal`, `filter`, `renaming`, `acted`, `drop-slot`, `drop-mode`
- per row, `attr="{xpath}"` read on each row's node: `has-children`, `load-error`, `no-drop`
- Rules and keys: `match`, `key` (XPath, e.g. @id), `label` (text with {xpath}, e.g. {@friendly}), `rename` (XPath, e.g. @name), `volatile` (space-separated attribute names), `can-have-children`, `empty-text`
- events: Select, Clear, Open, DoubleClick, Delete, Renamed, ContextMenu, Menu, Action, Change, ExpandRequest, ChildrenLoaded, DragOver, Drop, FileUploadStarted, FileUploadComplete
- methods: getSelection, setSelection, getDataLocation, getSrcDataLocation, reveal, expandAll, collapseAll, pathOf, sort, filter, rename

```xml
<tree name="remote" hide-root="true" has-children="{@lazy}" load-error="{@failed}">
  <rule match="node" key="@id"><div class="xl-title">{@name}</div></rule>
</tree>

<trigger view="v" component="remote" event="ExpandRequest" step="fetch"/>
<step id="fetch">
  <alias name="at" value="{selection(!)}" model="value"/>
  <operation name="change" value="#cloud">
    <store type="append" select="{$at}"><node id="{uuid()}" name="New node"/></store>
  </operation>
</step>
```

## Guidance

- Bind it to the top node: it is the root row, and the rules match each node's children. One `rule` per kind of node (`match`, `key`); `hide-root="true"` starts at the bound node's children. Give it `label` in a rows/columns/flow panel: that names the tree.
- Children on demand: `can-have-children="true"` on the rule and `xlink:href` on the node, or `has-children="{@lazy}"` and an ExpandRequest step that appends them.
- `path` writes the selected row's path (for crumb2); `reveal` opens the way to a key. `checkboxes="true"` with `cascade`.
- Delete fires Delete only; a Drop step moves the node by `drop-slot` and `drop-mode`. `upload="true"` uploads into the bound container, not the folder under the pointer.
- An `ximage` in a rule needs `alt` (`""` for folder and file icons). ARIA tree keys inside; Tab leaves.
