> 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/togglecaptions.md).

# toggleCaptions()

Toggles the captions panel visibility state.&#x20;

If the captions panel is currently shown, then it will be hidden. And vice-versa -> if the captions panel is currently hidden, then it will be shown. There is also an optional param to set a concrete target visibility state, but you may use [hideCaptions()](/reference/sdk/methods/hidecaptions.md) and [showCaptions()](/reference/sdk/methods/showcaptions.md) to achieve similar functionality.

```javascript
//This will toggle the captions panel visibility state
sambaFrame.toggleCaptions();

//This will show the captions panel, equivalent to sambaFrame.showCaptions();
sambaFrame.toggleCaptions(true); 

//This will hide the captions panel, equivalent to sambaFrame.hideCaptions();
sambaFrame.toggleCaptions(false);
```

**Sample use case**: \
You may have a custom button in your application to control the captions panel visibility.
