2019-07-17 21:05:57 +00:00
---
layout: page
title: Control Sidebar Plugin
---
2019-07-29 13:40:18 +00:00
The control sidebar component is part of AdminLTE's layout as the right sidebar.
##### Usage
This plugin can be activated as a jQuery plugin or using the data api. To activate the plugin, you must first add the HTML markup to your layout, then create the toggle button as shown below.
###### HTML Markup
{: .text-bold }
```html
<!-- Control Sidebar -->
< aside class = "control-sidebar control-sidebar-dark" >
<!-- Control sidebar content goes here -->
< / aside >
<!-- /.control - sidebar -->
```
###### Data api
{: .text-bold }
Add `data-widget="control-sidebar"` to any button or a element to activate the plugin.
```html
< a href = "#" data-widget = "control-sidebar" > Toggle Control Sidebar< / a >
```
###### jQuery
{: .text-bold }
Just like all other AdminLTE plugins, you can also activate the toggle button using jQuery by running the following example.
```js
$("#my-toggle-button").ControlSidebar('toggle');
```
##### Options
|---
| Name | Type | Default | Description
|-|-|-|-
2019-08-30 09:45:07 +00:00
|controlsidebarSlide | Boolean | TRUE | Whether the sidebar should slide over the content or push the content to make space for itself.
|scrollbarTheme | Boolean | `os-theme-light` | Scrollbar Theme used while SideBar Fixed
|scrollbarAutoHide | Boolean | `l` | Scrollbar auto-hide trigger
2019-07-29 13:40:18 +00:00
{: .table .table-bordered .bg-light}
> ##### Tip!
> You can use any option via the data-attributes like this to enable auto collapse sidebar on 768 pixels width.
> ```html
2019-08-30 09:45:07 +00:00
> <a href="#" data-widget="control-sidebar" data-controlsidebar-slide="false">Toggle Control Sidebar</a>
2019-07-29 13:40:18 +00:00
> ```
{: .quote-info}
##### Events
{: .mt-4}
|---
| Event Type | Description
|-|-
2019-08-20 10:35:22 +00:00
|expanded.lte.controlsidebar | Triggered after a control sidebar expands.
|collapsed.lte.controlsidebar | Triggered after a control sidebar collapses.
2019-07-29 13:40:18 +00:00
{: .table .table-bordered .bg-light}
2019-08-20 10:35:22 +00:00
Example: `$('#toggle-button').on('expanded.lte.controlsidebar', handleExpandedEvent)`
2020-09-21 07:32:01 +00:00
##### Methods
{: .mt-4}
|---
| Method | Description
|-|-
|collapse | Collapses the control-sidebar
|show | Show's the control-sidebar
|toggle | Toggles the state of the control-sidebar expanded and collapsed
{: .table .table-bordered .bg-light}
Example: `$('#toggle-button').ControlSidebar('toggle')`