Getting Started with React File Manager Component
22 Jul 20267 minutes to read
This section explains how to create and configure the File Manager component in a React application.
To get started quickly with the React File Manager, refer to the video below:
Prerequisites
| Requirement | Version |
|---|---|
| React | 15.5.4 or higher |
| Node.js | 14.0.0 or above |
| Yarn (optional) | 0.25 or above |
React supported versions
| React version | Minimum Syncfusion React File Manager version |
|---|---|
| React v19 | 29.1.33 and above |
| React v18 | 20.2.36 and above |
| React v17 | 18.3.50 and above |
| React v16 | 16.2.45 and above |
Browser Support
| Browser | Supported versions |
|---|---|
| Chrome | Latest |
| Firefox | Latest |
| Opera | Latest |
| Edge | 13+ |
| Internet Explorer (IE) | 11+ |
| Safari | 9+ |
| iOS Safari | 9+ |
| Android Browser / Chrome for Android | 4.4+ |
| Windows Mobile | IE 11+ |
Setup for local development
Easily set up a React application using create-vite-app, which provides a faster development environment, smaller bundle sizes, and optimized builds compared to traditional tools like create-react-app. For detailed steps, refer to the Vite installation instructions. Vite sets up your environment using JavaScript and optimizes your application for production.
Note: To create a React application using
create-react-app, refer to this documentation for more details.
To create a new React application, run one of the following commands based on your preferred language:
React with JavaScript
npx create-vite@latest my-app -- --template reactReact with TypeScript
npx create-vite@latest my-app -- --template react-tsDuring the setup process, the CLI will prompt you for a few configuration options. Select the following:
- Which linter to use? → ESLint
- Install with npm and start now? → Yes
Selecting Yes automatically installs the project dependencies and starts the development server.
After verifying that the application starts successfully, terminate the development server in the terminal and proceed to the next step.
Then, navigate to the project directory:
cd my-appAdding React File Manager packages
To install the File Manager component, use the following command:
npm i @syncfusion/ej2-react-filemanagerAdding CSS reference
Themes for Syncfusion® File Manager component can be applied using CSS files provided through npm theme packages. For available themes, refer to the Themes documentation.
Install the Tailwind 3 theme package using the following command:
npm install @syncfusion/ej2-tailwind3-theme --saveThen add the following CSS reference to the src/App.css file:
@import "../node_modules/@syncfusion/ej2-tailwind3-theme/styles/file-manager/index.css";Note: If you want to use combined component styles, make use of the Custom Resource Generator (CRG) in your application.
Adding File Manager component
The File Manager component code should be placed in the src/App.tsx file.
To enable file operation functionality in the File Manager, configure the url property within the ajaxSettings. This URL handles the file operation requests from the server.
import { FileManagerComponent } from '@syncfusion/ej2-react-filemanager';
import './App.css';
function App() {
let hostUrl: string = "https://physical-service.syncfusion.com/";
let ajaxSettings: object = {
url: hostUrl + "api/FileManager/FileOperations"
};
let height: string = "375px";
return (
<FileManagerComponent id="file" height={height} ajaxSettings={ajaxSettings} />
);
}
export default App;import { FileManagerComponent } from '@syncfusion/ej2-react-filemanager';
import './App.css';
function App() {
let hostUrl = "https://physical-service.syncfusion.com/";
let ajaxSettings = {
url: hostUrl + "api/FileManager/FileOperations"
};
let height = "375px";
return (
<FileManagerComponent id="file" height={height} ajaxSettings={ajaxSettings} />
);
}
export default App;@import "../node_modules/@syncfusion/ej2-tailwind3-theme/styles/file-manager/index.css";Server-side setup
The sample uses https://physical-service.syncfusion.com/ as the url endpoint in ajaxSettings.
To use your own files, host a File Manager service and replace the url value with your service endpoint. See the File System Provider documentation for setup details.
Registering Your Syncfusion License
Generate a license key from the Syncfusion License Dashboard and register it before rendering your React application:
import { registerLicense } from '@syncfusion/ej2-base';
registerLicense('YOUR_LICENSE_KEY');Note: A valid Syncfusion license is required for production use. Without a valid license, a trial license warning message will be displayed.
Run the application
npm run devProduction build
To create an optimized production build:
npm run buildPreview the production build locally:
npm run previewTroubleshooting
-
File Manager not rendering styles: Ensure the theme CSS is imported in
App.cssand that you removed the default Vite CSS inindex.css. -
Trial license warning banner: Register a license key via
registerLicense()from@syncfusion/ej2-base. -
Port 5173 already in use: Stop the conflicting process or run Vite on a different port with
npm run dev -- --port 3000.