UI LibraryUI Library
Guide
Components
Styling
Repo
Guide
Components
Styling
Repo
  • Guide

    • Introduction
    • Getting Started
  • Components

    • CataUiAccordion
    • CataUiAccordionItem
    • CataUiAlert
    • CataUiAnchorMenu
    • CataUiBadge
    • CataUiButton
    • CataUiCollapse
    • CataUiDraggable
    • CataUiDropdown
    • CataUiDropover
    • CataUiFileTree
    • CataUiIcon
    • CataUiIconSwitch
    • CataUiInput
    • CataUiInputCheckbox
    • CataUiInputColor
    • CataUiInputDate
    • CataUiInputGroup
    • CataUiInputRadio
    • CataUiInputSearch
    • CataUiInputSelect
    • CataUiMasonry
    • CataUiMasonryTile
    • CataUiLogo
    • CataUiModal
    • CataUiPaginate
    • CataUiProgress
    • CataUiSpinner
    • CataUiStatusLabel
    • CataUiSwitch
    • CataUiTable
    • CataUiTableAG
    • CataUiTableFooter
    • CataUiTabs
    • CataUiTabSwitch
    • CataUiTooltip
  • Styling

    • Colors
    • Icons
    • Typography
    • Utils

CataUiFileTree

A hierarchical tree component for displaying nested file or folder structures with expandable/collapsible nodes.

<CataUiFileTree 
  v-model="fileTreeVModel"
  :items="fileTreeData"
  color="#fff"
  iconOpen="bi-folder2-open"
  iconClosed="bi-folder2" />

Props

PropDescriptionTypeDefaultRequired
colorThe color of icons and text in the file treeString'var(--color-grey-900)'false
iconClosedIcon displayed for closed/collapsed items (see Icons)String'bi-folder2'false
iconOpenIcon displayed for open/expanded items (see Icons)String'bi-folder2-open'false
itemsArray of hierarchical items to display in the file treeArraytrue
v-modelThe currently selected/active item objectObjecttrue

Events

The component does not emit custom events beyond the standard v-model update.

Data Structure

Item Object Properties

Each item in the file tree should have the following properties:

PropertyDescriptionTypeRequired
idUnique identifier for the itemNumber/Stringtrue
labelDisplay text for the itemStringtrue
dataOptional data to associate with the item (passed in v-model when selected)Anyfalse
childrenArray of child items (null for leaf nodes with no children)Array/nulltrue
iconOptional custom icon for leaf nodesStringfalse

Example Data Structure

// Reference for the active item
const fileTreeVModel = ref({});

// File tree data structure
const fileTreeData = [
    {
        id: 1,
        label: 'Documents',
        data: { type: 'folder' }, // Optional custom data for your application logic
        children: [ // Array of child items - use null if the item has no children
            {
                id: 2,
                label: 'Report.pdf',
                data: { type: 'file', extension: 'pdf' },
                icon: 'bi-file-pdf', // Optional custom icon for leaf nodes
                children: null, // Leaf node with no children
            },
            {
                id: 3,
                label: 'Images',
                data: { type: 'folder' },
                children: [
                    {
                        id: 4,
                        label: 'Photo.jpg',
                        data: { type: 'file', extension: 'jpg' },
                        icon: 'bi-file-image',
                        children: null,
                    }
                ],
            }
        ],
    },
]
Prev
CataUiDropover
Next
CataUiIcon