Your search did not match any results.

Left or Right Position


The Drawer is a dismissible or permanently visible panel used for navigation in responsive web applications. On opening, the Drawer can interact with the view in several modes: "shrink", "push", and "overlap". The view's content (an HTML string in this demo) is part of the Drawer's markup. The Drawer's content is defined using a template. Note that the Drawer does not interact with the toolbar because the latter is not defined in the Drawer's markup.

In this demo, you can use radio buttons under the Drawer to change its position and behavior.

To get started with the DevExtreme Drawer component, refer to the following tutorial for step-by-step instructions: Getting Started with Navigation Drawer.

Backend API
Copy to CodePen
const DemoApp = angular.module('DemoApp', ['dx', 'ngSanitize']); DemoApp.controller('DemoController', ($scope) => { $scope.text = text; $scope.elementAttr = { class: 'panel-list dx-theme-accent-as-background-color', }; $scope.navigation = navigation; $scope.selectedRevealMode = 'slide'; $scope.selectedOpenMode = 'shrink'; $scope.selectedPosition = 'left'; let drawerInstance; $scope.drawerOptions = { bindingOptions: { openedStateMode: 'selectedOpenMode', position: 'selectedPosition', revealMode: 'selectedRevealMode', }, opened: true, height: 400, closeOnOutsideClick: true, template: 'listTemplate', onInitialized(e) { drawerInstance = e.component; }, }; $scope.toolbarOptions = { items: [{ widget: 'dxButton', location: 'before', options: { icon: 'menu', onClick() { drawerInstance.toggle(); }, }, }], }; $scope.showModes = { items: ['push', 'shrink', 'overlap'], layout: 'horizontal', bindingOptions: { value: 'selectedOpenMode' }, }; $scope.positionModes = { items: ['left', 'right'], layout: 'horizontal', bindingOptions: { value: 'selectedPosition' }, }; $scope.showSubmenuModes = { items: ['slide', 'expand'], layout: 'horizontal', bindingOptions: { value: 'selectedRevealMode' }, }; });
<!DOCTYPE html> <html xmlns=""> <head> <title>DevExtreme Demo</title> <meta http-equiv="X-UA-Compatible" content="IE=edge" /> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0" /> <script src=""></script> <script>window.jQuery || document.write(decodeURIComponent('%3Cscript src="js/jquery.min.js"%3E%3C/script%3E'))</script> <link rel="stylesheet" type="text/css" href="" /> <link rel="stylesheet" type="text/css" href="" /> <script src=""></script> <script>window.angular || document.write(decodeURIComponent('%3Cscript src="js/angular.min.js"%3E%3C/script%3E'))</script> <script src=""></script> <script> (function () { try { window.angular.module('ngSanitize'); } catch (e) { return false; } return true; })() || document.write(decodeURIComponent('%3Cscript src="js/angular-sanitize.min.js"%3E%3C\/script%3E')) </script> <script src=""></script> <script src="data.js"></script> <link rel="stylesheet" type="text/css" href="styles.css" /> <script src="index.js"></script> </head> <body class="dx-viewport"> <div class="demo-container" ng-app="DemoApp" ng-controller="DemoController"> <div dx-toolbar="toolbarOptions"></div> <div dx-drawer="drawerOptions"> <div data-options="dxTemplate: {name: 'listTemplate'}" dx-list="{ dataSource: navigation, hoverStateEnabled: false, focusStateEnabled: false, activeStateEnabled: false, width: 200, elementAttr: elementAttr }" > </div> <div id="content" class="dx-theme-background-color" ng-bind-html="text"></div> </div> <div class="options"> <div class="caption">Options</div> <div class="options-container"> <div class="option"> <label>Opened state mode</label> <div dx-radio-group="showModes"></div> </div> <div class="option"> <label>Position</label> <div dx-radio-group="positionModes"></div> </div> <div ng-if="selectedOpenMode !== 'push'" class="option"> <label>Reveal mode</label> <div dx-radio-group="showSubmenuModes"></div> </div> </div> </div> </div> </body> </html>
.dx-toolbar { background-color: rgba(191, 191, 191, 0.15); padding: 5px 10px; } .dx-list-item-icon-container, .dx-toolbar-before { width: 36px; padding-right: 0 !important; text-align: center; } .dx-list-item-content { padding-left: 10px !important; } .dx-button { background-color: rgba(191, 191, 191, -0.15); border: none; } .panel-list { height: 400px; } .dx-drawer-expand.dx-drawer-right .panel-list { float: right; } .panel-list .dx-list-item { color: #fff; border-top: 1px solid rgba(221, 221, 221, 0.2); } .panel-list .dx-list-item .dx-icon { color: #fff !important; } .options { padding: 20px; background-color: rgba(191, 191, 191, 0.15); } .options-container { display: flex; align-items: center; } .caption { font-size: 18px; font-weight: 500; } .option { margin-top: 10px; display: inline-block; margin-right: 50px; } label { font-weight: bold; } #content { height: 100%; padding: 10px 20px; } #content h2 { font-size: 26px; }
const navigation = [ { id: 1, text: 'Products', icon: 'product' }, { id: 2, text: 'Sales', icon: 'money' }, { id: 3, text: 'Customers', icon: 'group' }, { id: 4, text: 'Employees', icon: 'card' }, { id: 5, text: 'Reports', icon: 'chart' }, ]; const text = ` <h2> <b>Drawer Demo</b> </h2> <p> Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Penatibus et magnis dis parturient. Eget dolor morbi non arcu risus. Tristique magna sit amet purus gravida quis blandit. Auctor urna nunc id cursus metus aliquam eleifend mi in. Tellus orci ac auctor augue mauris augue neque gravida. Nullam vehicula ipsum a arcu. Nullam ac tortor vitae purus faucibus ornare suspendisse sed nisi. Cursus in hac habitasse platea dictumst. Egestas dui id ornare arcu. Dictumst vestibulum rhoncus est pellentesque elit ullamcorper dignissim.</p><p>Mauris rhoncus aenean vel elit scelerisque mauris pellentesque pulvinar. Neque volutpat ac tincidunt vitae semper quis lectus. Sed sed risus pretium quam vulputate dignissim suspendisse in. Urna nec tincidunt praesent semper feugiat nibh sed pulvinar. Ultricies lacus sed turpis tincidunt id aliquet risus feugiat. Amet cursus sit amet dictum sit amet justo donec enim. Vestibulum rhoncus est pellentesque elit ullamcorper. Id aliquet risus feugiat in ante metus dictum at. </p>`;