> For the complete documentation index, see [llms.txt](https://docs.digitalsamba.com/reference/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.digitalsamba.com/reference/sdk/methods/togglelibraryfile.md).

# toggleLibraryFile()

Toggles a concrete file's open/close state.

If the file is currently opened, then it will be closed. And vice versa -> if the file is currently closed, then it will be opened. There is also an optional param to set a concrete target state, but you may use [closeLibraryFile()](/reference/sdk/methods/closelibraryfile.md) and [openLibraryFile()](/reference/sdk/methods/openlibraryfile.md) to achieve similar functionality.

```javascript
//This will toggle the file's open/close state
sambaFrame.toggleLibraryFile('c0771004-c9fc-4308-be4f-6264d8e486af');

//This will open the file, equivalent to sambaFrame.openLibraryFile();
sambaFrame.toggleLibraryFile('c0771004-c9fc-4308-be4f-6264d8e486af', true); 

//This will close the file, equivalent to sambaFrame.closeLibraryFile();
sambaFrame.toggleLibraryFile('c0771004-c9fc-4308-be4f-6264d8e486af', false);
```

**Sample use case**: \
You may have buttons in your integration to control file opening and closing.
