Your search did not match any results.
Drawer

Top or Bottom Position

Documentation

This example shows a Drawer that opens from the top or bottom of the view. You can use the radio buttons under the Drawer to change its position and behavior in relation to the view.

@model IEnumerable<DevExtreme.NETCore.Demos.Models.NavigationItem> @{ var showModes = new[] { "push", "shrink", "overlap" }; var positionModes = new[] { "top", "bottom" }; var showSubmenuModes = new[] { "slide", "expand" }; } <div class="toolbar"> @(Html.DevExtreme().Toolbar() .Items(items => { items.Add() .Widget(w => w .Button() .Icon("menu") .OnClick("openButton_click") ) .Location(ToolbarItemLocation.Before); }) ) </div> <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" class="dx-theme-background-color"> <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. In hac habitasse platea dictumst vestibulum. Blandit libero volutpat sed cras. 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.Mollis nunc sed id semper risus in hendrerit. Enim sit amet venenatis urna cursus.Amet aliquam id diam maecenas. Viverra nam libero justo laoreet sit amet cursus.</p> </div> </text>) .Template(@<text> <div> @(Html.DevExtreme().List() .DataSource(Model) .ElementAttr("class", "panel-list dx-theme-accent-as-background-color") ) </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> <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.NETCore.Demos.Models.SampleData; using Microsoft.AspNetCore.Mvc; namespace DevExtreme.NETCore.Demos.Controllers { public class DrawerController : Controller { public ActionResult TopOrBottomPosition() { return View(SampleData.NavigationItems); } } }
.dx-toolbar { background-color: rgba(191, 191, 191, .15); padding: 5px 10px; } .dx-list-item-icon-container, .dx-toolbar-before { width: 36px; padding-right: 0px!important; text-align: center; } .dx-list-item-content { padding-left: 10px !important; } .dx-button { background-color: rgba(191, 191, 191, -0.15); border: none; } .dx-drawer-shrink #content { overflow: hidden; transition: all 0.4s ease-out; column-width: 900px; } .dx-drawer-shrink.dx-drawer-opened #content { column-width: 300px; margin-right: -10px; } .panel-list { height: 200px; pointer-events: none; } .panel-list .dx-list-item { color: #fff; text-align: center; border-top: 1px solid rgba(221, 221, 221, .2); } .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; } #content h2 { font-size: 26px; }