[Solidjs-TreeView] data-selected of dom element doesn't respect selectedValue
#3284
-
|
When passing |
Beta Was this translation helpful? Give feedback.
Answered by
segunadebayo
Apr 1, 2026
Replies: 1 comment
-
|
This is working as expected. When Make sure you're using a signal and passing both props: const [selectedValue, setSelectedValue] = createSignal<string[]>([])
<TreeView.Root
selectedValue={selectedValue()}
onSelectionChange={({ selectedValue }) => setSelectedValue(selectedValue)}
>
{/* ... */}
</TreeView.Root>If you want to prevent selection entirely, pass a static value without updating in the callback. |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
segunadebayo
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This is working as expected. When
selectedValueis provided, the component runs in controlled mode — it always reflects the value you pass and won't update internally on click.Make sure you're using a signal and passing both props:
If you want to prevent selection entirely, pass a static value without updating in the callback.