{
  "$schema": "https://ai.syncfusion.com/schema/registry-item.json",
  "name": "file-manager-template",
  "framework": "react",
  "type": "registry:component",
  "component": "FileManager",
  "variant": "template",
  "dependencies": [
    "@syncfusion/ej2-react-filemanager",
    "@syncfusion/ej2-react-splitbuttons"
  ],
  "description": "File manager with templated navigation pane, card-style large icons and custom details columns.",
  "meta": {
    "essentialStudioRelease": "2026 Volume 3 (v35.1.37)",
    "license": "commercial-or-community",
    "licenseNote": "The Syncfusion package is licensed. The composition in this file is source you own and edit. See https://ai.syncfusion.com/licensing.md",
    "requiresLicenseKey": true,
    "requiresServerEndpoint": true,
    "platformIndex": "https://ai.syncfusion.com/react/llms.txt",
    "skillPack": "syncfusion/react-ui-components-skills",
    "docs": "https://ai.syncfusion.com/gallery/react/js/file-manager-template.md"
  },
  "files": [
    {
      "target": "src/components/file-manager-template/FileManager.jsx",
      "content": "import { useRef } from 'react';\nimport { createRoot as reactCreateRoot } from 'react-dom/client';\nimport { FileManagerComponent, Inject, NavigationPane, DetailsView, Toolbar } from '@syncfusion/ej2-react-filemanager';\nimport { DropDownButtonComponent } from '@syncfusion/ej2-react-splitbuttons';\n/**\n * File Manager template sample\n */\nconst SAMPLE_CSS = `\n.e-filemanager.e-fm-template-sample .e-list-icon {\n    height: 20px !important;\n    margin: 0 !important;\n    width: 20px !important;\n}\n.e-dropdown-btn.filemanager-dropdown-button {\n    border: none;\n    margin-right: -6px;\n    box-shadow: none;\n    background: transparent;\n}\n.e-dropdown-btn.filemanager-dropdown-button:hover, .e-dropdown-btn.filemanager-dropdown-button.e-btn:hover {\n    background: #d4d4d4;\n}\n.fluent2-dark .e-dropdown-btn.filemanager-dropdown-button:hover, .fluent2-dark .e-dropdown-btn.filemanager-dropdown-button.e-btn:hover,\n.fluent-dark .e-dropdown-btn.filemanager-dropdown-button:hover, .fluent-dark .e-dropdown-btn.filemanager-dropdown-button.e-btn:hover,\n.material3-dark .e-dropdown-btn.filemanager-dropdown-button:hover, .material3-dark .e-dropdown-btn.filemanager-dropdown-button.e-btn:hover,\n.tailwind3-dark .e-dropdown-btn.filemanager-dropdown-button:hover, .tailwind3-dark .e-dropdown-btn.filemanager-dropdown-button.e-btn:hover,\n.fluent2-highcontrast .e-dropdown-btn.filemanager-dropdown-button:hover, .fluent2-highcontrast .e-dropdown-btn.filemanager-dropdown-button.e-btn:hover,\n.highcontrast .e-dropdown-btn.filemanager-dropdown-button:hover, .highcontrast .e-dropdown-btn.filemanager-dropdown-button.e-btn:hover,\n.bootstrap5\\\\.3-dark .e-dropdown-btn.filemanager-dropdown-button:hover, .bootstrap5\\\\.3-dark .e-dropdown-btn.filemanager-dropdown-button.e-btn:hover {\n    background: #3d3d3d;\n}\n.bootstrap5\\\\.3 .e-dropdown-btn.filemanager-dropdown-button {\n    color: #242424;\n}\n.e-filemanager.e-fm-template-sample .e-grid .e-gridheader .e-fe-grid-icon + .e-rowcell, .e-filemanager .e-grid .e-gridheader .e-fe-grid-icon + .e-headercell, .e-filemanager .e-grid .e-gridcontent .e-fe-grid-icon + .e-rowcell, .e-filemanager .e-grid .e-gridcontent .e-fe-grid-icon + .e-headercell {\n    padding-left: 6px;\n}\n.e-fm-template-sample .e-nav-pane-node .e-icons {\n    font-size: larger;\n}\n.e-fm-template-sample .custom-icon-card {\n    padding: 8px;\n    border: 1px solid #ccc;\n    border-radius: 10px;\n    height: 100%;\n    box-sizing: border-box;\n    display: flex;\n    flex-direction: column;\n    justify-content: flex-start;\n    align-items: center;\n}\n.e-fm-template-sample .file-header {\n    display: flex;\n    justify-content: space-between;\n    align-items: center;\n    width: 100%;\n    margin-bottom: 10px;\n}\n.e-fm-template-sample .left-info {\n    display: flex;\n    align-items: center;\n    gap: 8px;\n    overflow: hidden;\n    flex-shrink: 1;\n    flex-grow: 1;\n}\n.e-fm-template-sample .file-name {\n    font-size: 14px;\n    font-weight: 600;\n    white-space: nowrap;\n    overflow: hidden;\n    text-overflow: ellipsis;\n    max-width: 160px;\n}\n.e-fm-template-sample .file-formattedDate {\n    font-size: 12px;\n    margin-top: 8px;\n    text-align: center;\n    font-weight: 600;\n}\n.e-filemanager.e-fm-template-sample.e-fe-mobile .e-large-icons .e-list-parent .e-list-item {\n    height: 185px;\n    width: 100px;\n    margin: 8px 4px;\n}\n.e-filemanager.e-fm-template-sample.e-fe-mobile .e-large-icons .e-list-parent .e-list-item .file-icon {\n    width: 150px;\n    height: 90px;\n}\n.e-filemanager.e-fm-template-sample.e-fe-mobile .e-large-icons .e-list-parent .e-list-item .file-name {\n    max-width: 100px;\n}\n.e-filemanager.e-fm-template-sample .e-large-icons .e-list-item {\n    height: 230px;\n    width: 200px;\n}\n#template_filemanager.e-fm-template-sample .e-layout-content {\n    overflow: hidden;\n}\n.e-filemanager.e-fm-template-sample .e-large-icons .e-list-parent .e-list-item .file-icon {\n    width: 190px;\n    height: 150px;\n    background-repeat: no-repeat;\n    background-position: center center;\n    background-size: contain;\n    margin-bottom: 10px;\n}\n\n.tailwind3 .e-filemanager.e-fm-template-sample .e-treeview .e-text-content,\n.tailwind3-dark .e-filemanager.e-fm-template-sample .e-treeview .e-text-content {\n    top: 0;\n}\n.e-filemanager.e-fm-template-sample .e-treeview .e-list-text {\n    display: inline-flex;\n}\n\n/* Background images */\n.background-folder { background-image: url('/file-manager/template/folders.svg'); }\n.background-png { background-image: url('/file-manager/template/image-png.svg'); }\n.background-pptx { background-image: url('/file-manager/template/pptx.png'); }\n.background-jpg { background-image: url('/file-manager/template/image-jpg.svg'); }\n.background-doc { background-image: url('/file-manager/template/docx.png'); }\n.background-pdf { background-image: url('/file-manager/template/pdfphoto.png'); }\n.background-txt { background-image: url('/file-manager/template/text.png'); }\n.background-video { background-image: url('/file-manager/template/video.png'); }\n.background-audio { background-image: url('/file-manager/template/music.png'); }\n.background-xlsx { background-image: url('/file-manager/template/xlsx.png'); }\n.background-zip { background-image: url('/file-manager/template/zip.svg'); }\n/* People */\n.background-Adam { background-image: url('/file-manager/template/Adam.png'); }\n.background-Andrew { background-image: url('/file-manager/template/Andrew.png'); }\n.background-Ellie { background-image: url('/file-manager/template/Ellie.png'); }\n.background-Jameson { background-image: url('/file-manager/template/Jameson.png'); }\n.background-John { background-image: url('/file-manager/template/John.png'); }\n.background-Josie { background-image: url('/file-manager/template/Josie.png'); }\n\n/* Food */\n.background-Applepie { background-image: url('/file-manager/template/Apple pie.png'); }\n.background-Bread { background-image: url('/file-manager/template/Bread.png'); }\n.background-Doughnut { background-image: url('/file-manager/template/Doughnut.png'); }\n.background-Nuggets { background-image: url('/file-manager/template/Nuggets.png'); }\n.background-Sugarcookie { background-image: url('/file-manager/template/Sugar cookie.png'); }\n\n/* Nature */\n.background-bird { background-image: url('/file-manager/template/bird.jpg'); }\n.background-sea { background-image: url('/file-manager/template/sea.jpg'); }\n.background-seaview { background-image: url('/file-manager/template/seaview.jpg'); }\n.background-snow { background-image: url('/file-manager/template/snow.jpg'); }\n.background-snowfall { background-image: url('/file-manager/template/snowfall.jpg'); } `;\nconst hostUrl = 'https://physical-service.syncfusion.com/';\nconst actionItems = [\n    { text: 'Open', iconCss: 'e-icons e-folder-open' },\n    { text: 'Download', iconCss: 'e-icons e-download' },\n    { text: 'Refresh', iconCss: 'e-icons e-refresh' },\n    { text: 'Delete', iconCss: 'e-icons e-trash' },\n];\nconst Template = () => {\n    const fmRef = useRef(null);\n    const formatSize = (bytes) => {\n        if (!bytes)\n            return '0 B';\n        const sizes = ['B', 'KB', 'MB', 'GB', 'TB'];\n        let i = 0;\n        let value = bytes;\n        while (value >= 1024 && i < sizes.length - 1) {\n            value /= 1024;\n            i++;\n        }\n        return `${value.toFixed(1)} ${sizes[i]}`;\n    };\n    const getBackgroundCss = (item) => {\n        const NamedFileBackgrounds = {\n            'Adam.png': 'background-Adam',\n            'Andrew.png': 'background-Andrew',\n            'Ellie.png': 'background-Ellie',\n            'Jameson.png': 'background-Jameson',\n            'John.png': 'background-John',\n            'Josie.png': 'background-Josie',\n            'Apple pie.png': 'background-Applepie',\n            'Bread.png': 'background-Bread',\n            'Doughnut.png': 'background-Doughnut',\n            'Nuggets.png': 'background-Nuggets',\n            'Sugar cookie.png': 'background-Sugarcookie',\n            'bird.jpg': 'background-bird',\n            'sea.jpg': 'background-sea',\n            'seaview.jpg': 'background-seaview',\n            'snow.jpg': 'background-snow',\n            'snowfall.jpg': 'background-snowfall'\n        };\n        const ExtensionBackgrounds = {\n            jpg: 'background-jpg',\n            jpeg: 'background-jpg',\n            png: 'background-png',\n            pptx: 'background-pptx',\n            pdf: 'background-pdf',\n            mp4: 'background-video',\n            mp3: 'background-audio',\n            docx: 'background-doc',\n            txt: 'background-txt',\n            xlsx: 'background-xlsx',\n            zip: 'background-zip',\n        };\n        if (!item.isFile)\n            return 'file-icon background-folder';\n        if (NamedFileBackgrounds[item.name])\n            return `file-icon ${NamedFileBackgrounds[item.name]}`;\n        const ext = (item.name.split('.').pop() || '').toLowerCase();\n        return `file-icon ${ExtensionBackgrounds[ext] || 'background-default'}`;\n    };\n    const getIconsForFolders = (item) => {\n        const iconMap = {\n            Files: 'e-folder',\n            Documents: 'e-file-document',\n            Downloads: 'e-download',\n            Pictures: 'e-thumbnail',\n            Music: 'e-file-format',\n            Videos: 'e-video',\n            Employees: 'e-export-png',\n            Food: 'e-export-png',\n            Nature: 'e-export-png'\n        };\n        return iconMap[item.name] || 'e-folder';\n    };\n    const getFileIconCssClass = (item) => {\n        if (!item.isFile)\n            return '';\n        const extensionMap = {\n            jpg: 'image',\n            jpeg: 'image',\n            png: 'image',\n            gif: 'image',\n            mp3: 'music',\n            wav: 'music',\n            mp4: 'video',\n            avi: 'video',\n            doc: 'doc',\n            docx: 'docx',\n            ppt: 'pptx',\n            pptx: 'pptx',\n            xls: 'xlsx',\n            xlsx: 'xlsx',\n            txt: 'txt',\n            js: 'js',\n            css: 'css',\n            html: 'html',\n            exe: 'exe',\n            msi: 'msi',\n            php: 'php',\n            xml: 'xml',\n            zip: 'zip',\n            rar: 'rar',\n            pdf: 'pdf'\n        };\n        const extension = (item.name.split('.').pop() || '').toLowerCase();\n        const iconType = extensionMap[extension] || 'unknown';\n        return `e-list-icon e-fe-${iconType}`;\n    };\n    const onActionSelect = (action, item) => {\n        if (!fmRef.current)\n            return;\n        switch (action) {\n            case 'Open':\n                fmRef.current.openFile(item.name);\n                break;\n            case 'Download':\n                fmRef.current.downloadFiles([item.name]);\n                break;\n            case 'Refresh':\n                fmRef.current.refreshFiles();\n                break;\n            case 'Delete':\n                fmRef.current.deleteFiles([item.name]);\n                break;\n            default:\n                break;\n        }\n    };\n    // Render DropDownButtonComponent (React) into each action host\n    const renderDDBIntoHost = (hostEl) => {\n        const fileName = hostEl.getAttribute('data-name') || '';\n        const isFile = (hostEl.getAttribute('data-isfile') || 'false') === 'true';\n        const items = isFile ? actionItems.filter(i => i.text !== 'Open') : actionItems;\n        const onSelect = (args) => {\n            const action = args?.item?.text || '';\n            onActionSelect(action, { name: fileName, isFile });\n        };\n        if (!hostEl.hasAttribute('data-ddb-initialized')) {\n            const root = reactCreateRoot(hostEl);\n            root.render(<DropDownButtonComponent items={items} cssClass=\"e-caret-hide filemanager-dropdown-button\" iconCss=\"e-icons e-more-vertical-1\" select={onSelect}/>);\n            hostEl.setAttribute('data-ddb-initialized', 'true');\n        }\n    };\n    const menuOpen = (args) => {\n        args.cancel = true;\n    };\n    const fileLoad = (args) => {\n        const validModules = ['DetailsView', 'LargeIconsView'];\n        if (validModules.indexOf(args.module) !== -1) {\n            setTimeout(() => {\n                const actionBtn = args.element.querySelector('.action-ddb');\n                if (actionBtn && !actionBtn.hasAttribute('data-ddb-initialized')) {\n                    renderDDBIntoHost(actionBtn);\n                }\n            }, 10);\n        }\n    };\n    const detailsViewSettings = {\n        columns: [\n            {\n                field: 'name',\n                headerText: 'Name',\n                template: (item) => (<div>{item.name}</div>)\n            },\n            {\n                field: 'size',\n                headerText: 'Size',\n                template: (item) => (<div>{item.isFile ? formatSize(item.size) : '-'}</div>)\n            },\n            {\n                field: '_fm_modified',\n                headerText: 'DateModified',\n                format: 'MM/dd/yyyy hh:mm a'\n            },\n            {\n                headerText: 'Actions',\n                template: (item) => (<div className=\"action-ddb\" data-name={item.name} data-isfile={item.isFile}/>)\n            }\n        ]\n    };\n    const largeIconsTemplate = (item) => {\n        const formattedDate = item.dateCreated\n            ? new Date(item.dateCreated).toLocaleDateString('en-US', {\n                year: 'numeric',\n                month: 'long',\n                day: 'numeric',\n            })\n            : '';\n        const iconClass = getFileIconCssClass(item);\n        const backgroundClass = getBackgroundCss(item);\n        return (<div className=\"custom-icon-card\">\n        <div className=\"file-header\">\n          <div className=\"left-info\">\n            {item.isFile && <div className={iconClass}></div>}\n            <div className=\"file-name\" title={item.name}>\n              {item.name}\n            </div>\n          </div>\n          <div className=\"action-ddb\" data-name={item.name} data-isfile={item.isFile}></div>\n        </div>\n        <div className={backgroundClass} title={item.name}></div>\n        <div className=\"file-formattedDate\">Created on {formattedDate}</div>\n      </div>);\n    };\n    const navigationPaneTemplate = (item) => {\n        const iconClass = getIconsForFolders(item);\n        return (<div className=\"e-nav-pane-node\" style={{ display: 'inline-flex', alignItems: 'center' }}>\n        <span className={`e-icons ${iconClass}`}></span>\n        <span className=\"folder-name\" style={{ marginLeft: 8 }}>{item.name}</span>\n      </div>);\n    };\n    return (<div>\n      <div className=\"control-section\">\n        <style>{SAMPLE_CSS}</style>\n        <div className=\"sample-container\">\n          <FileManagerComponent id=\"template_filemanager\" ref={fmRef} ajaxSettings={{\n            url: `${hostUrl}api/FileManager/FileOperations`,\n            uploadUrl: `${hostUrl}api/FileManager/Upload`,\n            downloadUrl: `${hostUrl}api/FileManager/Download`,\n            getImageUrl: `${hostUrl}api/FileManager/GetImage`\n        }} cssClass=\"e-fm-template-sample\" height=\"600px\" detailsViewSettings={detailsViewSettings} largeIconsTemplate={largeIconsTemplate} navigationPaneTemplate={navigationPaneTemplate} menuOpen={menuOpen} fileLoad={fileLoad}>\n            <Inject services={[NavigationPane, DetailsView, Toolbar]}/>\n          </FileManagerComponent>\n        </div>\n      </div>\n    </div>);\n};\nexport default Template;\n"
    }
  ]
}