# file-manager-enable-disable-toolbar-item

> File manager with external buttons that enable or disable the New Folder toolbar item at runtime.

**Framework:** react  **Component:** FileManager  **Variant:** enable-disable-toolbar-item

## 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/react/ts/file-manager-enable-disable-toolbar-item.json
```

**Install Package(s)**

```bash
npm install @syncfusion/ej2-react-filemanager @syncfusion/ej2-react-buttons
```

**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-enable-disable-toolbar-item/FileManager.tsx

```tsx
import { DetailsView, FileManagerComponent, NavigationPane, Toolbar, Inject, type ViewType } from '@syncfusion/ej2-react-filemanager';
import { ButtonComponent } from '@syncfusion/ej2-react-buttons';

/**
 * File Manager enable or disable a toolbar item sample
 */
const EnableDisableToolbarItem = () => {
  let fileObj: FileManagerComponent;
  let hostUrl: string = "https://physical-service.syncfusion.com/";
  let height: string = "330px";
  let view: ViewType = "Details";
  let ajaxSettings: object = {
      downloadUrl: hostUrl + 'api/FileManager/Download',
      getImageUrl: hostUrl + "api/FileManager/GetImage",
      uploadUrl: hostUrl + 'api/FileManager/Upload',
      url: hostUrl + "api/FileManager/FileOperations"
  };
  let toolbarSettings: object = { items: ['NewFolder', 'Refresh', 'View', 'Details'] };

  function onEnable() {
    fileObj.enableToolbarItems(["newfolder"]);
  }
  function onDisable() {
    fileObj.disableToolbarItems(["newfolder"]);
  }
  return (
  <div>
      <ButtonComponent id='enable' onClick={onEnable.bind(this)} cssClass='e-success'>Enable New Folder toolbar item</ButtonComponent>
      <ButtonComponent id='disable' onClick={onDisable.bind(this)} cssClass='e-danger'>Disable New Folder toolbar item</ButtonComponent>
      <div className="control-section">
          <FileManagerComponent ref={ (s: FileManagerComponent | null) => { fileObj = s as FileManagerComponent; }} id="file" height={height} view={view}
              ajaxSettings = {ajaxSettings}
              toolbarSettings = {toolbarSettings} >
                <Inject services={[ NavigationPane, DetailsView, Toolbar]} />
          </FileManagerComponent>
      </div>
  </div>
  );
}
export default EnableDisableToolbarItem;

```
