# file-manager-template

> File manager with templated navigation pane, card-style large icons and custom details columns.

**Framework:** vue  **Component:** FileManager  **Variant:** template

## Get this item

**If you are an agent, fetch the JSON.** Source is inlined, so one request is enough and no tooling is required:

```
GET https://ai.syncfusion.com/r/vue/file-manager-template.json
```

**Install Package(s)**

```bash
npm install @syncfusion/ej2-vue-filemanager @syncfusion/ej2-vue-splitbuttons
```

**Notes**

- Syncfusion release: 2026 Volume 3 (v35.1.37)
- The Syncfusion package is licensed. The composition in this file is source you own and edit. See https://ai.syncfusion.com/licensing.md

## Source files

### src/components/file-manager-template/FileManager.vue

```vue
<template>
  <div class="control-section file-template">
    <div class="sample-container">
      <ejs-filemanager
        id="filemanager"
        ref="fileManager"
        :ajaxSettings="ajaxSettings"
        :cssClass="cssClass"
        :height="height"
        :largeIconsTemplate="'largeTpl'"
        :navigationPaneTemplate="navigationPaneTemplate"
        :detailsViewSettings="detailsViewSettings"
        :menuOpen="onMenuOpen"
      >
        <template v-slot:largeTpl="{ data }">
          <div class="custom-icon-card">
            <div class="file-header">
              <div class="left-info">
                <div v-if="data.isFile" :class="['e-list-icon', getFileIconCssClass(data)]"></div>
                <div class="file-name" :title="data.name">{{ data.name }}</div>
              </div>
              <ejs-dropdownbutton
                class="e-caret-hide filemanager-dropdown-button"
                iconCss="e-icons e-more-vertical-1"
                :items="actionMenuItems(data)"
                @select="(args: any) => onActionSelectVue(args, data)"
              />
            </div>
            <div :class="getBackgroundCss(data)" :title="data.name"></div>
            <div class="file-formattedDate">
              <template v-if="data.dateCreated">
                Created on {{
                  new Date(data.dateCreated).toLocaleDateString('en-US', {
                    year: 'numeric',
                    month: 'long',
                    day: 'numeric'
                  })
                }}
              </template>
            </div>
          </div>
        </template>
      </ejs-filemanager>
    </div>
  </div>
</template>

<script lang="ts">
import { createApp, defineComponent, h, ref } from 'vue';
import { FileManagerComponent, NavigationPane, Toolbar, DetailsView } from '@syncfusion/ej2-vue-filemanager';
import { DropDownButtonComponent } from '@syncfusion/ej2-vue-splitbuttons';

const hostUrl = 'https://physical-service.syncfusion.com/';

// Navigation pane node template (render function, so no runtime template compiler is needed).
const demoNavigationPaneTemplate = createApp({}).component('navigationPaneTemplate', defineComponent({
  data() {
    return { data: {} as any };
  },
  computed: {
    getIconsForFolders(): string {
      const iconMap: Record<string, string> = {
        Files: 'e-folder',
        Documents: 'e-file-document',
        Downloads: 'e-download',
        Pictures: 'e-thumbnail',
        Music: 'e-file-format',
        Videos: 'e-video',
        Employees: 'e-export-png',
        Food: 'e-export-png',
        Nature: 'e-export-png'
      };
      return iconMap[this.data.name] || 'e-folder';
    }
  },
  render() {
    return h('div', { class: 'e-nav-pane-node', style: 'display:inline-flex;align-items:center;' }, [
      h('span', { class: ['e-icons', this.getIconsForFolders] }),
      h('span', { class: 'folder-name', style: 'margin-left:8px;' }, this.data?.name)
    ]);
  }
}));

const fileManagerInstance = ref<any>(null);
let lastOpenedDropdown: any = null;

// Details view "Actions" column template.
const buttontemplateVue = createApp({}).component('demo', defineComponent({
  data() {
    return {
      data: {} as any,
      actionItems: [
        { text: 'Open', iconCss: 'e-icons e-folder-open' },
        { text: 'Download', iconCss: 'e-icons e-download' },
        { text: 'Refresh', iconCss: 'e-icons e-refresh' },
        { text: 'Delete', iconCss: 'e-icons e-trash' }
      ]
    };
  },
  methods: {
    actionMenuItems(item: any) {
      return item?.isFile
        ? this.actionItems.filter((i) => i.text !== 'Open')
        : this.actionItems;
    },
    handleBeforeOpen() {
      const dropdown = (this.$refs.dropdownbutton as any).ej2Instances;
      if (lastOpenedDropdown && lastOpenedDropdown !== dropdown) {
        lastOpenedDropdown.closePopup();
      }
      lastOpenedDropdown = dropdown;
    },
    onActionSelectVue(args: any, item: any) {
      const action = args?.item?.text || '';
      const fm = fileManagerInstance.value;
      if (!fm) return;

      switch (action) {
        case 'Open':
          fm.openFile(item.name);
          break;
        case 'Download':
          fm.downloadFiles([item.name]);
          break;
        case 'Refresh':
          fm.refreshFiles();
          break;
        case 'Delete':
          fm.deleteFiles([item.name]);
          break;
      }
      if (lastOpenedDropdown) {
        lastOpenedDropdown.closePopup();
      }
    }
  },
  render() {
    const item = this.data;
    return h(DropDownButtonComponent, {
      ref: 'dropdownbutton',
      items: this.actionMenuItems(item),
      iconCss: 'e-icons e-more-vertical-1',
      class: 'e-caret-hide filemanager-dropdown-button',
      onBeforeOpen: this.handleBeforeOpen,
      onSelect: (args: any) => this.onActionSelectVue(args, item)
    });
  }
}));

const buttonTemplate = function () {
  return {
    template: buttontemplateVue
  };
};

const formatSize = (bytes: number) => {
  if (!bytes) return '0 B';

  const units = ['B', 'KB', 'MB', 'GB', 'TB'];
  let index = 0;
  let value = bytes;

  while (value >= 1024 && index < units.length - 1) {
    value /= 1024;
    index++;
  }

  return `${value.toFixed(1)} ${units[index]}`;
};

// Details view "Size" column template.
const SizeColTpl = createApp({}).component('SizeColTpl', defineComponent({
  data() {
    return {
      data: {} as any
    };
  },
  computed: {
    readableSize(): string {
      return formatSize(this.data?.size || 0);
    }
  },
  render() {
    return h('div', this.data?.isFile ? this.readableSize : '-');
  }
}));

const sizeTemplate = function () {
  return {
    template: SizeColTpl
  };
};

export default {
  components: {
    'ejs-filemanager': FileManagerComponent,
    'ejs-dropdownbutton': DropDownButtonComponent
  },
  data() {
    return {
      navigationPaneTemplate: function () {
        return { template: demoNavigationPaneTemplate };
      },
      ajaxSettings: {
        url: hostUrl + 'api/FileManager/FileOperations',
        uploadUrl: hostUrl + 'api/FileManager/Upload',
        downloadUrl: hostUrl + 'api/FileManager/Download',
        getImageUrl: hostUrl + 'api/FileManager/GetImage'
      },
      detailsViewSettings: {
        columns: [
          {
            field: 'name',
            headerText: 'File Name',
            minWidth: 120,
            width: 'auto',
            customAttributes: { class: 'e-fe-grid-name' },
            template: '${name}'
          },
          {
            field: 'size',
            headerText: 'Size',
            width: 120,
            template: sizeTemplate
          },
          {
            field: '_fm_modified',
            headerText: 'Date Modified',
            minWidth: 50,
            width: '190',
            format: 'MM/dd/yyyy hh:mm a'
          },
          {
            headerText: 'Actions',
            template: buttonTemplate
          }
        ]
      },
      cssClass: 'e-fm-template-sample',
      height: '600px',
      actionItems: [
        { text: 'Open', iconCss: 'e-icons e-folder-open' },
        { text: 'Download', iconCss: 'e-icons e-download' },
        { text: 'Refresh', iconCss: 'e-icons e-refresh' },
        { text: 'Delete', iconCss: 'e-icons e-trash' }
      ]
    };
  },
  methods: {
    onMenuOpen(args: any) {
      args.cancel = true;
    },

    onActionSelect(action: string, item: any) {
      const fm = (this.$refs.fileManager as any)?.ej2Instances;
      if (!fm) return;
      switch (action) {
        case 'Open': fm.openFile(item.name); break;
        case 'Download': fm.downloadFiles([item.name]); break;
        case 'Refresh': fm.refreshFiles(); break;
        case 'Delete': fm.deleteFiles([item.name]); break;
      }
    },

    onActionSelectVue(args: any, item: any) {
      this.onActionSelect(args?.item?.text || '', item);
    },

    actionMenuItems(item: any) {
      return item?.isFile ? this.actionItems.filter((i) => i.text !== 'Open') : this.actionItems;
    },

    getBackgroundCss(item: any) {
      const NamedFileBackgrounds: Record<string, string> = {
        'Adam.png': 'background-Adam',
        'Andrew.png': 'background-Andrew',
        'Ellie.png': 'background-Ellie',
        'Jameson.png': 'background-Jameson',
        'John.png': 'background-John',
        'Josie.png': 'background-Josie',
        'Apple pie.png': 'background-Applepie',
        'Bread.png': 'background-Bread',
        'Doughnut.png': 'background-Doughnut',
        'Nuggets.png': 'background-Nuggets',
        'Sugar cookie.png': 'background-Sugarcookie',
        'bird.jpg': 'background-bird',
        'sea.jpg': 'background-sea',
        'seaview.jpg': 'background-seaview',
        'snow.jpg': 'background-snow',
        'snowfall.jpg': 'background-snowfall'
      };

      const ExtensionBackgrounds: Record<string, string> = {
        jpg: 'background-jpg',
        jpeg: 'background-jpg',
        png: 'background-png',
        pptx: 'background-pptx',
        pdf: 'background-pdf',
        mp4: 'background-video',
        mp3: 'background-audio',
        docx: 'background-doc',
        txt: 'background-txt',
        xlsx: 'background-xlsx',
        zip: 'background-zip'
      };

      if (!item.isFile) return 'file-icon background-folder';
      if (NamedFileBackgrounds[item.name]) return `file-icon ${NamedFileBackgrounds[item.name]}`;
      const ext = (item.name.split('.').pop() || '').toLowerCase();
      return `file-icon ${ExtensionBackgrounds[ext] || 'background-default'}`;
    },

    // Icon for file types (used in large icon header)
    getFileIconCssClass(item: any) {
      if (!item.isFile) return '';
      const extensionMap: Record<string, string> = {
        jpg: 'image',
        jpeg: 'image',
        png: 'image',
        gif: 'image',
        mp3: 'music',
        wav: 'music',
        mp4: 'video',
        avi: 'video',
        doc: 'doc',
        docx: 'docx',
        ppt: 'pptx',
        pptx: 'pptx',
        xls: 'xlsx',
        xlsx: 'xlsx',
        txt: 'txt',
        js: 'js',
        css: 'css',
        html: 'html',
        exe: 'exe',
        msi: 'msi',
        php: 'php',
        xml: 'xml',
        zip: 'zip',
        rar: 'rar',
        pdf: 'pdf'
      };
      const extension = (item.name.split('.').pop() || '').toLowerCase();
      const iconType = extensionMap[extension] || 'unknown';
      return `e-fe-${iconType}`;
    }
  },
  mounted() {
    fileManagerInstance.value = (this.$refs.fileManager as any)?.ej2Instances;
  },
  provide() {
    return {
      filemanager: [NavigationPane, DetailsView, Toolbar]
    };
  }
};
</script>

<style scoped>
.file-template .sample-container {
  margin: 10px 10px 10px 10px;
}

.file-template :deep(.e-filemanager.e-fm-template-sample .e-list-icon) {
  height: 20px !important;
  margin: 0 !important;
  width: 20px !important;
}

.file-template :deep(.e-dropdown-btn.filemanager-dropdown-button) {
  border: none;
  margin-right: -6px;
  box-shadow: none;
  background: transparent;
}

.file-template :deep(.e-dropdown-btn.filemanager-dropdown-button:hover),
.file-template :deep(.e-dropdown-btn.filemanager-dropdown-button.e-btn:hover) {
  background: #d4d4d4;
}

.fluent2-dark .file-template :deep(.e-dropdown-btn.filemanager-dropdown-button:hover),
.fluent2-dark .file-template :deep(.e-dropdown-btn.filemanager-dropdown-button.e-btn:hover),
.fluent-dark .file-template :deep(.e-dropdown-btn.filemanager-dropdown-button:hover),
.fluent-dark .file-template :deep(.e-dropdown-btn.filemanager-dropdown-button.e-btn:hover),
.material3-dark .file-template :deep(.e-dropdown-btn.filemanager-dropdown-button:hover),
.material3-dark .file-template :deep(.e-dropdown-btn.filemanager-dropdown-button.e-btn:hover),
.tailwind3-dark .file-template :deep(.e-dropdown-btn.filemanager-dropdown-button:hover),
.tailwind3-dark .file-template :deep(.e-dropdown-btn.filemanager-dropdown-button.e-btn:hover),
.fluent2-highcontrast .file-template :deep(.e-dropdown-btn.filemanager-dropdown-button:hover),
.fluent2-highcontrast .file-template :deep(.e-dropdown-btn.filemanager-dropdown-button.e-btn:hover),
.highcontrast .file-template :deep(.e-dropdown-btn.filemanager-dropdown-button:hover),
.highcontrast .file-template :deep(.e-dropdown-btn.filemanager-dropdown-button.e-btn:hover),
.bootstrap5\.3-dark .file-template :deep(.e-dropdown-btn.filemanager-dropdown-button:hover),
.bootstrap5\.3-dark .file-template :deep(.e-dropdown-btn.filemanager-dropdown-button.e-btn:hover) {
  background: #3d3d3d;
}

.bootstrap5\.3 .file-template :deep(.e-dropdown-btn.filemanager-dropdown-button) {
  color: #242424;
}

.file-template :deep(.e-filemanager.e-fm-template-sample .e-grid .e-gridheader .e-fe-grid-icon + .e-rowcell),
.file-template :deep(.e-filemanager .e-grid .e-gridheader .e-fe-grid-icon + .e-headercell),
.file-template :deep(.e-filemanager .e-grid .e-gridcontent .e-fe-grid-icon + .e-rowcell),
.file-template :deep(.e-filemanager .e-grid .e-gridcontent .e-fe-grid-icon + .e-headercell) {
  padding-left: 6px;
}

.file-template :deep(.e-fm-template-sample .e-nav-pane-node .e-icons) {
  font-size: larger;
}

.file-template :deep(.e-fm-template-sample .custom-icon-card) {
  padding: 8px;
  border: 1px solid #ccc;
  border-radius: 10px;
  height: 100%;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: center;
}

.file-template :deep(.e-fm-template-sample .file-header) {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  margin-bottom: 10px;
}

.file-template :deep(.e-fm-template-sample .left-info) {
  display: flex;
  align-items: center;
  gap: 8px;
  overflow: hidden;
  flex-shrink: 1;
  flex-grow: 1;
}

.file-template :deep(.e-fm-template-sample .file-name) {
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 160px;
}

.file-template :deep(.e-fm-template-sample .file-formattedDate) {
  font-size: 12px;
  margin-top: 8px;
  text-align: center;
  font-weight: 600;
}

.file-template :deep(.e-filemanager.e-fm-template-sample.e-fe-mobile .e-large-icons .e-list-parent .e-list-item) {
  height: 185px;
  width: 100px;
  margin: 8px 4px;
}

.file-template :deep(.e-filemanager.e-fm-template-sample.e-fe-mobile .e-large-icons .e-list-parent .e-list-item .file-icon) {
  width: 150px;
  height: 90px;
}

.file-template :deep(.e-filemanager.e-fm-template-sample.e-fe-mobile .e-large-icons .e-list-parent .e-list-item .file-name) {
  max-width: 100px;
}

.file-template :deep(.e-filemanager.e-fm-template-sample .e-large-icons .e-list-item) {
  height: 240px;
  width: 210px;
}

.file-template :deep(.e-filemanager.e-fm-template-sample .e-large-icons .e-list-parent .e-list-item .file-icon) {
  width: 190px;
  height: 150px;
  background-repeat: no-repeat;
  background-position: center center;
  background-size: contain;
  margin-bottom: 10px;
}

.file-template :deep([id^="templateDiv_"]) {
  display: contents;
}

.tailwind3 .file-template :deep(.e-filemanager.e-fm-template-sample .e-treeview .e-text-content),
.tailwind3-dark .file-template :deep(.e-filemanager.e-fm-template-sample .e-treeview .e-text-content) {
  top: 0;
}

.file-template :deep(.e-filemanager.e-fm-template-sample .e-treeview .e-list-text) {
  display: inline-flex;
}

.file-template :deep(.background-folder) { background-image: url('/file-manager/template/folders.svg'); }
.file-template :deep(.background-png) { background-image: url('/file-manager/template/image-png.svg'); }
.file-template :deep(.background-pptx) { background-image: url('/file-manager/template/pptx.png'); }
.file-template :deep(.background-jpg) { background-image: url('/file-manager/template/image-jpg.svg'); }
.file-template :deep(.background-doc) { background-image: url('/file-manager/template/docx.png'); }
.file-template :deep(.background-pdf) { background-image: url('/file-manager/template/pdfphoto.png'); }
.file-template :deep(.background-txt) { background-image: url('/file-manager/template/text.png'); }
.file-template :deep(.background-video) { background-image: url('/file-manager/template/video.png'); }
.file-template :deep(.background-audio) { background-image: url('/file-manager/template/music.png'); }
.file-template :deep(.background-xlsx) { background-image: url('/file-manager/template/xlsx.png'); }
.file-template :deep(.background-zip) { background-image: url('/file-manager/template/zip.svg'); }

.file-template :deep(.background-Adam) { background-image: url('/file-manager/template/Adam.png'); }
.file-template :deep(.background-Andrew) { background-image: url('/file-manager/template/Andrew.png'); }
.file-template :deep(.background-Ellie) { background-image: url('/file-manager/template/Ellie.png'); }
.file-template :deep(.background-Jameson) { background-image: url('/file-manager/template/Jameson.png'); }
.file-template :deep(.background-John) { background-image: url('/file-manager/template/John.png'); }
.file-template :deep(.background-Josie) { background-image: url('/file-manager/template/Josie.png'); }

.file-template :deep(.background-Applepie) { background-image: url('/file-manager/template/Apple pie.png'); }
.file-template :deep(.background-Bread) { background-image: url('/file-manager/template/Bread.png'); }
.file-template :deep(.background-Doughnut) { background-image: url('/file-manager/template/Doughnut.png'); }
.file-template :deep(.background-Nuggets) { background-image: url('/file-manager/template/Nuggets.png'); }
.file-template :deep(.background-Sugarcookie) { background-image: url('/file-manager/template/Sugar cookie.png'); }

.file-template :deep(.background-bird) { background-image: url('/file-manager/template/bird.jpg'); }
.file-template :deep(.background-sea) { background-image: url('/file-manager/template/sea.jpg'); }
.file-template :deep(.background-seaview) { background-image: url('/file-manager/template/seaview.jpg'); }
.file-template :deep(.background-snow) { background-image: url('/file-manager/template/snow.jpg'); }
.file-template :deep(.background-snowfall) { background-image: url('/file-manager/template/snowfall.jpg'); }
</style>

```
