Vue Tree view

Vue Bootstrap 5 Tree view plugin

MDB treeview plugin is used to show hierarchical information which starts from the root item and proceed to its children and their respective children. Each item besides the root has a parent and can have children.

The parent is the node which is higher in the hierarchy and the child the one that is lower. Siblings are items which have one and the same parent. Items can be expanded and collapsed.

Note: Read the API tab to find all available options and advanced customization

Basic example - DOM

Initialize tree view structure with MDBTreeview component. If you want to nest your lists - wrap a text of a li tag in a tag and define other ul after it. Add .show class to the list that you want to expand from the beginning.

Basic example - JavaScript

You can define whole structure of tree using only JavaScript. There are some props in data that you can use to customize it:

  • name - defines a text for an item
  • children - defines a nested list and it's children
  • icon - defines a custom expanding icon for the nested list
  • show - defines if list expands from the beginning or not
  • disabled - defines if list item is disabled or not

Open on item click

Use a openOnClick property to define opening lists of treeview by click only on the arrow or on the whole list item.


Use a accordion property to enable or disable opening only one list at the same level.


Use a selectable property to set up checkboxes in every list item.


Expand your treeview to the particular list using the expand(ID) method.


Collapse your treeview using the collapse() method.

Custom icons - DOM

You can add your custom icons to your treeview. For non-nested elements - paste code of an icon in the item. For nested elements - declare span tag inside a element and paste there the code for your icon.

Use a rotationAngle property to define a rotation angle of nested lists icons.

Custom icons - JavaScript

Add icons to the list elements by pasting an icon code in the name property. If you want to change the rotatable icon in the nested list - use icon property instead.


Set the color of an active item using the treeviewColor property.

Current color: primary


Use a line property to set up an additional line in every nested list.

Disabled - DOM

Add .treeview-disabled class to the a (if nested) or li tag to disable your list item. You can expand disabled items, but you can't select them.

Disabled - JavaScript

To generate a disabled list item, use disabled property.


Use the .filter(string) method to expand list items that meet your requirements.

Vue Tree view - API


        import { MDBTreeview } from "mdb-vue-tree-view";


Name Type Default Description
accordion Boolean false Allows only one list on the same level to be opened
line Boolean false Adds a line to every nested list
openOnClick Boolean true Enables opening list by clicking only on the icon
tag String 'div' Sets component wrapper tag
treeviewColor String 'primary' Defines a text and background color for an active or hovered item
selectable Boolean false Setup checkboxes for the every list item
structure Array ` Setup structure of tree elements
rotationAngle Number 90 Defines a rotation angle of the icons in nested lists


Name Description
collapse Collapses every list in treeview
expand('id') Expands a treeview to the list with a particular ID
filter(string) Expands list items that meet your requirements


Name Description
select This event fires immediately when one of the treeview checkboxes are changed. Selected items are available with items property of the event.
active-item This event fires immediately when one of the treeview list items are selected by click. Selected item is available with item property of the event.