React Drawer Props
This section describes options that configure the Drawer widget's contents, behavior and appearance.
animationDuration
Specifies the duration of the drawer's opening and closing animation (in milliseconds). Applies only if animationEnabled is true.
closeOnOutsideClick
Event (jQuery or EventObject)
The raised event. It is a dxEvent or a jQuery.Event when you use jQuery.
The function passed to this option enables you to specify a custom condition for widget closing. For instance, you can prevent closing until a user clicks a specific element on the view:
jQuery
$(function() { $("#drawerContainer").dxDrawer({ // ... closeOnOutsideClick: function(e) { return e.target === $("#someElement").get()[0]; } }); });
Angular
import { DxDrawerModule } from "devextreme-angular"; // ... export class AppComponent { // ... drawer_closeOnOutsideClick(e) { return e.target === document.getElementById("someElement"); } } @NgModule({ imports: [ // ... DxDrawerModule ], // ... })
<dx-drawer ... [closeOnOutsideClick]="drawer_closeOnOutsideClick"> </dx-drawer>
elementAttr
Specifies the attributes to be attached to the widget's root element.
jQuery
$(function(){ $("#drawerContainer").dxDrawer({ // ... elementAttr: { id: "elementId", class: "class-name" } }); });
Angular
<dx-drawer ... [elementAttr]="{ id: 'elementId', class: 'class-name' }"> </dx-drawer>
import { DxDrawerModule } from "devextreme-angular"; // ... export class AppComponent { // ... } @NgModule({ imports: [ // ... DxDrawerModule ], // ... })
ASP.NET MVC Control
@(Html.DevExtreme().Drawer() .ElementAttr("class", "class-name") // ===== or ===== .ElementAttr(new { @id = "elementId", @class = "class-name" }) // ===== or ===== .ElementAttr(new Dictionary<string, object>() { { "id", "elementId" }, { "class", "class-name" } }) )
@(Html.DevExtreme().Drawer() _ .ElementAttr("class", "class-name") ' ===== or ===== .ElementAttr(New With { .id = "elementId", .class = "class-name" }) ' ===== or ===== .ElementAttr(New Dictionary(Of String, Object) From { { "id", "elementId" }, { "class", "class-name" } }) )
height
This option accepts a value of one of the following types:
Number
The height in pixels.String
A CSS-accepted measurement of height. For example,"55px"
,"80%"
,"auto"
,"inherit"
.Function
A function returning either of the above. For example:JavaScriptheight: function() { return window.innerHeight / 1.5; }
maxSize
Specifies the drawer's width or height (depending on the drawer's position) in the opened state.
minSize
Specifies the drawer's width or height (depending on the drawer's position) in the closed state.
onDisposing
A function that is executed before the widget is disposed of.
Name | Type | Description |
---|---|---|
component |
The widget's instance. |
|
element |
The widget's container. It is an HTML Element or a jQuery Element when you use jQuery. |
|
model |
The model data. Available only if you use Knockout. |
onInitialized
Name | Type | Description |
---|---|---|
component |
The widget's instance. |
|
element |
The widget's container. It is an HTML Element or a jQuery Element when you use jQuery. |
onOptionChanged
Name | Type | Description |
---|---|---|
name |
The modified option if it belongs to the first level. Otherwise, the first-level option it is nested into. |
|
model |
The model data. Available only if you use Knockout. |
|
element |
The widget's container. It is an HTML Element or a jQuery Element when you use jQuery. |
|
component |
The widget's instance. |
|
fullName |
The path to the modified option that includes all parent options. |
|
value | any |
The modified option's new value. |
openedStateMode
The following modes are available:
"overlap"
The drawer overlaps the view."shrink"
The view's width decreases to accommodate the drawer."push"
The drawer partially displaces the view.
Use the DrawerOpenedStateMode
enum to specify this option when the widget is used as an ASP.NET MVC Control. This enum accepts the following values: Overlap
, Shrink
, and Push
.
See Also
position
Use "before" and "after" if the Drawer should be positioned differently in right-to-left and regular representations. The following table shows the dependency between the rtlEnabled value and "before" and "after" positions:
"before" | "after" | |
---|---|---|
rtlEnabled: false | left side of the view | right side of the view |
rtlEnabled: true | right side of the view | left side of the view |
Top or Bottom Position Demo Left or Right Position Demo
Use the DrawerPosition
enum to specify this option when the widget is used as an ASP.NET MVC Control. This enum accepts the following values: Left
, Right
, Top
, Bottom
, Before
, and After
.
revealMode
The following modes are available:
"slide"
The drawer slides in. The drawer and its content are animated."expand"
The drawer expands from the closed position. The drawer's width is animated; its content is not.
Use the DrawerRevealMode
enum to specify this option when the widget is used as an ASP.NET MVC Control. This enum accepts the following values: Slide
and Expand
.
See Also
rtlEnabled
When this option is set to true, the widget text flows from right to left, and the layout of elements is reversed. To switch the entire application/site to the right-to-left representation, assign true to the rtlEnabled field of the object passed to the DevExpress.config(config) method.
DevExpress.config({ rtlEnabled: true });
See Also
- Right-to-Left Support Demo: DataGrid | Navigation Widgets | Editors
target
Specifies the target element associated with the drawer. Applies only when the openedStateMode is "overlap".
This option accepts one of the following values.
A CSS selector, or a jQuery selector if you use jQuery
target: '#targetElement';
A jQuery wrapper
target: $('#targetElement');
A DOM element
target: document.getElementById('#targetElement');
See Also
width
This option accepts a value of one of the following types:
Number
The width in pixels.String
A CSS-accepted measurement of width. For example,"55px"
,"80%"
,"auto"
,"inherit"
.Function
A function returning either of the above. For example:JavaScriptwidth: function() { return window.innerWidth / 1.5; }
If you have technical questions, please create a support ticket in the DevExpress Support Center.