For more examples, visit the Storybook.

Example
<StudsTree>
    <StudsTreeItem Text="app">
        <StudsTreeItem Text="page.tsx" />
        <StudsTreeItem Text="layout.tsx" />
    </StudsTreeItem>
    <StudsTreeItem Text="components">
        <StudsTreeItem Text="header.tsx" />
        <StudsTreeItem Text="footer.tsx" />
    </StudsTreeItem>
</StudsTree>

StudsTree Parameters

AllowCheckBoxes
bool
default:"false"

Gets or sets whether the tree displays checkboxes for each item.

AllowCheckChildren
bool
default:"true"

Gets or sets whether checking a parent item also checks all its children.

AllowCheckParents
bool
default:"true"

Gets or sets whether checking children affects the parent’s checked state.

SingleExpand
bool
default:"false"

Gets or sets whether only one branch can be expanded at a time.

Value
Object

Gets or sets the selected item’s value.

SelectItemAriaLabel
string

Gets or sets the aria-label for the selected item.

ItemContentCssClass
string

Gets or sets the CSS class for the item content.

ItemIconCssClass
string

Gets or sets the CSS class for the item icon.

ItemLabelCssClass
string

Gets or sets the CSS class for the item label.

ValueChanged
EventCallback<Object>

Callback invoked when the selected value changes.

CheckedValues
IEnumerable<object>

Gets or sets the collection of checked item values.

Data
IEnumerable

Specifies the collection of data items which StudsTree will create its items from.

ItemRender
Action<TreeItemRenderEventArgs>

A callback that will be invoked when item is rendered.

ChildContent
RenderFragment

Gets or sets the child items content.

CheckedValuesChanged
EventCallback<IEnumerable<object>>

Callback invoked when the checked values collection changes.

Change
EventCallback<TreeEventArgs>

Callback invoked when an item is selected.

Expand
EventCallback<TreeExpandEventArgs>

Callback invoked when an item is expanded.

Collapse
EventCallback<TreeEventArgs>

Callback invoked when an item is collapsed.

ItemContextMenu
EventCallback<TreeItemContextMenuEventArgs>

Callback invoked when right-clicking an item.

Attributes
Dictionary<string, object>

Specifies additional custom attributes that will be rendered by the component.

MouseEnter
EventCallback<ElementReference>

Gets or sets the callback that is invoked when the mouse enters an item.

MouseLeave
EventCallback<ElementReference>

Gets or sets the callback that is invoked when the mouse leaves an item.

ContextMenu
EventCallback<MouseEventArgs>

A callback that will be invoked when the user right-clicks the component. Commonly used to display a context menu.

Culture
CultureInfo
default:"CultureInfo.CurrentCulture"

Gets or sets the culture used to display localizable data (numbers, dates). Set by default to “CultureInfo.CurrentCulture”.

Style
string

Gets or sets the inline CSS style.

Visible
bool
default:"true"

Gets or sets a value indicating whether this “T:Studs.StudsComponent” is visible. Invisible components are not rendered.

StudsTreeItem Parameters

Text
string

Gets or sets the display text of the tree item.

Value
object

Gets or sets the value associated with this item.

Checkable
bool
default:"true"

Gets or sets whether this item can be checked.

HasChildren
bool
default:"false"

Gets or sets whether this item has child items.

Expanded
bool
default:"false"

Gets or sets whether this item is expanded.

Selected
bool
default:"false"

Gets or sets whether this item is selected.

Template
RenderFragment<StudsTreeItem>

Gets or sets custom template for rendering the item content.

ChildContent
RenderFragment

Gets or sets the child items content.

Tree
StudsTree

The StudsTree which this item is part of.

ParentItem
StudsTreeItem

The parent item of this tree item.

Data
IEnumerable

The children data.

ContentCssClass
string

Gets or sets the CSS class for the item content.

IconCssClass
string

Gets or sets the CSS class for the item icon.

LabelCssClass
string

Gets or sets the CSS class for the item label.

StudsTreeLevel Parameters

For data-bound scenarios:

TextProperty
string

Specifies the property name to use for item text.

CheckableProperty

Specifies the name of the property which provides values for the Checkable property of the child items.

ChildrenProperty
string

Specifies the property name that contains child items.

HasChildren
Func<object, bool>
default:"value => true"

Function that determines if an item has children.

Expanded
Func<object, bool>
default:"value => false"

Function that determines if an item should be expanded.

Selected
Func<object, bool>
default:"value => false"

Function that determines if an item should be selected.

Text
Func<object, string>

Function that determines the display text for an item.

Checkable
Func<object, bool>

Determines the if the checkbox of the child item can be checked.

Template
RenderFragment<StudsTreeItem>

Gets or sets the template.

Tree
StudsTree

The StudsTree which this item is part of.