EN
Getting started
51 · Extended UI

Tree view

Shows nested data such as category › subcategory › product group as collapsible branches. The whole structure is passed as a single items array.

PRO acun:tree
01

Basic usage

Every item in items has a label; child items go in the children array, with no depth limit. Branches start collapsed and open with the arrow button to the left of the name. The structure is marked with role="tree"; screen readers announce the arrow button as "Expand" or "Collapse".

LIVE EXAMPLE
<acun:tree :items="[
    ['label' => 'Electronics', 'children' => [
        ['label' => 'Computers', 'children' => [['label' => 'Laptops'], ['label' => 'Desktops']]],
        ['label' => 'Phones', 'children' => [['label' => 'Smartphones']]],
    ]],
    ['label' => 'Clothing', 'children' => [['label' => 'Women']]],
]" />
PropValues
itemsArray of ['label' => …, 'children' => […]]
02

Start expanded

expanded starts all branches open. To control a single branch, give the item open; an item's open always takes precedence over expanded, so you can keep some branches closed in an expanded tree with 'open' => false.

LIVE EXAMPLE
<acun:tree expanded :items="[
    ['label' => 'Electronics', 'children' => [
        ['label' => 'Computers', 'children' => [['label' => 'Laptop computers'], ['label' => 'Desktop computers']]],
        ['label' => 'Accessories', 'open' => false, 'children' => [['label' => 'Headphones']]],
    ]],
]" />
PropValues
expandedtrue | false (default false)
openPer item: true | false
API

Props and slots

The values the component accepts.

PropDefaultDescription
items[]Array of items (with the keys below)
expandedfalseStarts all branches open
items[].label — Displayed name (required)
items[].children[]Child items, with the same structure
items[].openexpandedStarts this branch open or closed
items[].hrefnullIf given, the name becomes a link
items[].badgenullCounter on the right
Acun UI · Tree viewDetailed usage and examples