It's very easy to add custom tree's, you can use the BaseTree component and extend from there. Our own trees, like the Content Tree and Media Tree do exactly this.
This is the Content Tree using the BaseTree, most of the methods are self explanatory by their name
If you want to view the entire component then you can view it on Github below
Reusing Content & Media Trees
You can reuse the built in content and media tree's in your own plugins / extensions. You can either embed the tree within your component - Just like we do in the Content Picker component. This is using the Tree within your own component
private async Task OnValueChangedHandler(object value)
{
if (value is Content content)
{
// Do what you want
}
}
Pickers
If you are just looking for the ability to pick some content or media in your components, then it would be better to just reuse the Content Picker or Media Picker that we use internally.
You can reuse them just as easily, where Value is the property you want to bind the selected value to: