Updated docs: Renamed children props to nodes for TreeView

This commit is contained in:
Bram 2024-11-21 19:07:49 +01:00 committed by GitHub
commit 327f26d12a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -5,11 +5,15 @@
## Default
The `children` prop accepts an array of child nodes. Each node should contain `id` and `text` properties.
The `nodes` prop accepts an array of child nodes. Each node should contain `id` and `text` properties.
Optional properties include `disabled`, `icon`, and `children`.
Optional properties include `disabled`, `icon`, and `nodes`.
A parent node contains `children` while a leaf node does not.
A parent node contains `nodes` (children) while a leaf node does not.
Note: in version 0.86.0 the `children` prop has been renamed to `nodes` to be compatible with Svelte 5 (`children`
[has become a reserved word](https://svelte.dev/docs/svelte/v5-migration-guide#The-children-prop-is-reserved) in
Svelte 5 to pass properties down to components).
<InlineNotification svx-ignore lowContrast title="Note:" kind="info" hideCloseButton>
<div class="body-short-01">Every node must have a unique id.</div>
@ -27,7 +31,7 @@ The destructured `let:node` contains the following properties:
<ListItem><strong>id</strong>: the node id</ListItem>
<ListItem><strong>text</strong>: the node text</ListItem>
<ListItem><strong>expanded</strong>: true if the node is expanded</ListItem>
<ListItem><strong>leaf</strong>: true if the node does not have children</ListItem>
<ListItem><strong>leaf</strong>: true if the node does not have child nodes</ListItem>
<ListItem><strong>disabled</strong>: true if the node is disabled</ListItem>
<ListItem><strong>selected</strong>: true if the node is selected</ListItem>
</UnorderedList>