# Getting Started with the Drawer

This guide demonstrates how to get up and running with the Kendo UI for jQuery Drawer.

After the completion of this guide, you will achieve the following end result:

```dojo
    <div id="drawer">
      <div id="drawer-content">
        <div class="k-d-flex k-align-items-center k-flex-column">
          <h3>Content area</h3>
          <p>Click on the drawer and pull to the right to expand it.</p>
          <p>Click anywhere on the content to collapse the drawer.</p>
        </div>
        <div class="k-d-flex k-align-items-center k-flex-column k-hidden">
          <h3>Content area 2</h3>
          <p>Additional content.</p>
        </div>
      </div>
    </div>
    <script>
      $(document).ready(function() {
        $("#drawer").kendoDrawer({
          mode: "push",
          template: `<ul><li class='k-selected' data-role='drawer-item'><span class='k-icon k-i-star'></span><span class='item-text'>item 1</span></li><li data-role='drawer-item'><span class='k-icon k-i-x-logo'></span><span class='item-text'>item 2</span></li></ul>`,
          position: 'left',
          mini: true,
          itemClick: function (e) {
            $("#drawer-content > div").addClass("k-hidden");
            $("#drawer-content > div").eq(e.item.index()).removeClass("k-hidden");
          }
        });
      });
    </script>
```

## 1. Create an Empty div Element

First, create an empty `<div>` element on the page that will serve as the main container of the Drawer component. Then, you will fill the `div` element with the content for each item in the Drawer.

```html
    <div id="drawer">
      <div id="drawer-content">
        <div class="k-d-flex k-align-items-center k-flex-column">
          <h3>Content Area</h3>
          <p>Click on the Drawer and pull to the right to expand it.</p>
          <p>Click anywhere on the content to collapse the Drawer.</p>
        </div>
        <div class="k-d-flex k-align-items-center k-flex-column k-hidden">
          <h3>Content Area 2</h3>
          <p>Additional content.</p>
        </div>
      </div>
    </div>
```

## 2. Initialize the Drawer

In this step, you'll initialize the Drawer component from the `<div>` element.

```javascript
    $("#drawer").kendoDrawer({
      mode: "push",
      template: `<ul>
      <li class='k-selected' data-role='drawer-item'><span class='k-icon k-i-star'></span><span class='item-text'>item 1</span></li>
      <li data-role='drawer-item'><span class='k-icon k-i-x-logo'></span><span class='item-text'>item 2</span></li>
      </ul>`
     });
```

## 3. Set the Position of the Drawer

Now, you can set the [`position`](https://www.telerik.com/kendo-jquery-ui/documentation/api/ui/drawer/configuration/position) of the Drawer.

```javascript
    $("#drawer").kendoDrawer({
      position: 'left'
     });
```

## 4. Enable the Mini Mode

In this step, you'll enable the [`mini`](https://www.telerik.com/kendo-jquery-ui/documentation/api/ui/drawer/configuration/mini) mode which displays a smaller version of the Drawer when the component is collapsed.

```javascript
    $("#drawer").kendoDrawer({
      mini: true
     });
```

## 5. Add Logic for Displaying and Hiding the Content

Now you are ready to use the [`itemClick`](https://www.telerik.com/kendo-jquery-ui/documentation/api/ui/drawer/events/itemclick) event to hide the current and display new content when an item in the Drawer is clicked.

```javascript
    $("#drawer").kendoDrawer({
        itemClick: function (e) {
            $("#drawer-content > div").addClass("k-hidden");
            $("#drawer-content > div").eq(e.item.index()).removeClass("k-hidden");
        }
     });
```

## Next Steps

* [Referencing Existing Component Instances](https://www.telerik.com/kendo-jquery-ui/documentation/intro/widget-basics/events-and-methods)
* [Demo Page for the Kendo UI for jQuery Drawer](https://demos.telerik.com/kendo-ui/drawer/index)

## See Also

* [JavaScript API Reference of the jQuery Drawer](https://www.telerik.com/kendo-jquery-ui/documentation/api/ui/drawer)
* [Knowledge Base Section](https://www.telerik.com/kendo-jquery-ui/documentation/knowledge-base)
