New to Kendo UI for Vue? Start a free 30-day trial

Showing Loading State When Expanding Nodes in Kendo UI for Vue TreeView

Updated on Oct 21, 2026

Environment

ProductKendo UI for Vue TreeView
VersionCurrent

Description

I need to show a loading spinner when a node in the Kendo UI for Vue TreeView is expanding and data is being loaded from the server.

This knowledge base article also answers the following questions:

  • How to add a loading spinner in Vue TreeView when expanding nodes?
  • How to show a loading indicator for server requests in TreeView?
  • How to implement a custom loading state in Kendo UI for Vue TreeView?

Solution

Track a loading state for each node and use a custom item slot to display a Loader next to the node text while its children are loading. The slot customizes the node content; it does not replace the built-in expand/collapse icon.

Follow these steps:

  1. Set hasChildren to true for nodes whose children are not loaded yet, and leave their items field unset. This lets you expand a node before its children are available.
  2. Handle the expandchange event to toggle the node's expanded state. Request children only when the node is expanded, has no loaded items, and is not already loading.
  3. Set the node's loading flag before starting the request. Assign the returned children to items, update hasChildren to reflect the result, and clear the flag in a finally block.
  4. Set the TreeView's item prop to a named slot. In the slot, use v-if to render the Loader only while that node's loading flag is active.

Runnable Example

The following example simulates a server request with a 1.5-second delay. Expand Furniture or Decor to see the loader, then expand Bed Linen to load another level. Loaded children are reused when you collapse and expand a node again.

Replace the loadChildren function with your server request when using this approach in your application.

Example
View Source
Loading ...

See Also