# file-manager-enable-disable-toolbar-item

> File manager with external buttons that enable or disable the New Folder toolbar item at runtime.

**Framework:** angular  **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/angular/file-manager-enable-disable-toolbar-item.json
```

**Install Package(s)**

```bash
npm install @syncfusion/ej2-angular-filemanager @syncfusion/ej2-angular-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/file-manager.component.html

```html
<div class="sample-container">
    <button ejs-button id="enable" cssClass="e-success">Enable New Folder toolbar item</button>
    <button ejs-button id="disable" cssClass="e-danger">Disable New Folder toolbar item</button>
    <br />
    <br />
    <ejs-filemanager id='file-manager' #fileManager [ajaxSettings]='ajaxSettings' [height]='height' (created)='onCreated()'>
    </ejs-filemanager>
</div>

```

### src/components/file-manager-enable-disable-toolbar-item/file-manager.component.ts

```typescript
import { Component, ViewChild, ViewEncapsulation } from '@angular/core';
import { FileManagerComponent, FileManagerModule, NavigationPaneService, ToolbarService, DetailsViewService } from '@syncfusion/ej2-angular-filemanager';
import { ButtonModule } from '@syncfusion/ej2-angular-buttons';
/**
 * File Manager enable or disable a toolbar item sample
 */
@Component({
    selector: 'control-content',
    templateUrl: 'file-manager.component.html',
    styleUrls: ['../file-manager-common.style.css'],
    encapsulation: ViewEncapsulation.None,
    providers: [NavigationPaneService, ToolbarService, DetailsViewService],
    standalone: true,
    imports: [FileManagerModule, ButtonModule]
})

export class EnableDisableToolbarItemController {
    @ViewChild('fileManager')
    public fileManagerInstance?: FileManagerComponent;
    public ajaxSettings?: object;
    public height?: number;
    public hostUrl: string = 'https://physical-service.syncfusion.com/';
    public ngOnInit(): void {
        this.ajaxSettings = {
            url: this.hostUrl + 'api/FileManager/FileOperations',
            getImageUrl: this.hostUrl + 'api/FileManager/GetImage',
            uploadUrl: this.hostUrl + 'api/FileManager/Upload',
            downloadUrl: this.hostUrl + 'api/FileManager/Download'
        };
        this.height = 330;
    }
    onCreated() {
        // Click event for enable button
        (document.getElementById("enable") as HTMLElement).addEventListener('click', () => {
            // Enable new folder toolbar item
            (this.fileManagerInstance as FileManagerComponent).enableToolbarItems(["newfolder"]);
        });
        // Click event for disable button
        (document.getElementById("disable") as HTMLElement).addEventListener('click', () => {
            // Disable new folder toolbar item
            (this.fileManagerInstance as FileManagerComponent).disableToolbarItems(["newfolder"]);
        });
    }
}

```
