Your search did not match any results.

Drawer - Top or Bottom Position

Drawer is a dismissible or permanently visible panel that usually contains navigation elements.

To open or close the Drawer component in this demo, click the 'Hamburger' button. Each Drawer visibility change can adjust the layout in the following ways (see openedStateMode):

  • "push"
    The Drawer partially displaces the view.

  • "shrink"
    The view shrinks to accommodate the Drawer.

  • "overlap"
    The Drawer overlaps the view.

Backend API
@model IEnumerable<DevExtreme.MVC.Demos.Models.NavigationItem> @{ var showModes = new[] { "push", "shrink", "overlap" }; var positionModes = new[] { "top", "bottom" }; var showSubmenuModes = new[] { "slide", "expand" }; } <div class="flex-container"> @(Html.DevExtreme().Toolbar() .ID("toolbar") .Items(items => { items.Add() .Widget(w => w .Button() .Icon("menu") .StylingMode(ButtonStylingMode.Text) .OnClick("openButton_click") ) .Location(ToolbarItemLocation.Before); } ) ) <div class="drawer"> @(Html.DevExtreme().Drawer() .ID("drawer") .OpenedStateMode(DrawerOpenedStateMode.Shrink) .Opened(false) .Position(DrawerPosition.Top) .Height(400) .RevealMode(DrawerRevealMode.Expand) .CloseOnOutsideClick(true) .Content(@<text> <div id="content"> <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> </div> </text>) .Template(@<text> <div> @(Html.DevExtreme().List() .DataSource(Model) .HoverStateEnabled(false) .FocusStateEnabled(false) .ActiveStateEnabled(false) .ElementAttr("class", "panel-list") ) </div> </text>) ) </div> <div class="options"> <div class="caption">Options</div> <div class="option"> <label>Opened state mode</label> @(Html.DevExtreme().RadioGroup() .Items(showModes) .Value(showModes[1]) .Layout(Orientation.Horizontal) .OnValueChanged("showMode_valueChanged") ) </div> <div class="option"> <label>Position</label> @(Html.DevExtreme().RadioGroup() .Items(positionModes) .Value(positionModes[0]) .Layout(Orientation.Horizontal) .OnValueChanged("position_valueChanged") ) </div> <div id="revealMode" class="option"> <label>Reveal mode</label> @(Html.DevExtreme().RadioGroup() .Items(showSubmenuModes) .Value(showSubmenuModes[1]) .Layout(Orientation.Horizontal) .OnValueChanged("submenuMode_valueChanged") ) </div> </div> </div> <script> function showMode_valueChanged(data) { var drawer = $("#drawer").dxDrawer("instance"); drawer.option("openedStateMode", data.value); if (data.value === 'push') { $("#revealMode").hide(); } else { $("#revealMode").show(); } } function position_valueChanged(data) { var drawer = $("#drawer").dxDrawer("instance"); drawer.option("position", data.value); } function submenuMode_valueChanged(data) { var drawer = $("#drawer").dxDrawer("instance"); drawer.option("revealMode", data.value); } function openButton_click() { var drawer = $("#drawer").dxDrawer("instance"); drawer.toggle(); } </script>
using DevExtreme.AspNet.Data; using DevExtreme.AspNet.Mvc; using DevExtreme.MVC.Demos.Models.SampleData; using System.Web.Mvc; namespace DevExtreme.MVC.Demos.Controllers { public class DrawerController : Controller { public ActionResult TopOrBottomPosition() { return View(SampleData.NavigationItems); } } }
.demo-container { overflow: visible; } .flex-container { display: flex; flex-direction: column; } .dx-drawer-content { display: flex; } #toolbar { background-color: var(--dx-component-color-bg); box-shadow: 0 2px 8px 0 rgba(0, 0, 0, 0.12), 0 2px 2px 0 rgba(0, 0, 0, 0.08); padding: 5px 10px; z-index: 10000; } .dx-drawer-shrink #content { overflow: hidden; transition: all 0.4s ease-out; column-width: 900px; } .dx-drawer-shrink.dx-drawer-opened #content { margin-right: -10px; } .panel-list { height: 200px; padding-top: 12px; background-color: var(--dx-color-main-bg); } .panel-list .dx-list-item { text-align: center; } .options { padding: 20px; background-color: rgba(191, 191, 191, .15); } .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; background-color: var(--dx-component-color-bg); } #content h2 { font-size: 26px; }

Use the radio buttons at the bottom of this demo module to try different layout modes. You can also change the Drawer's position and revealMode properties.

Note this demo's markup. The Drawer definition encloses the view content (the formatted text). The Drawer's own content (navigation links) is set by the template property. Finally, the toolbar markup is separate from other elements.

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