Your search did not match any results.

Top or Bottom Position


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.

Backend API
Copy to CodeSandBox
import React from 'react'; import Drawer from 'devextreme-react/drawer'; import RadioGroup from 'devextreme-react/radio-group'; import Toolbar from 'devextreme-react/toolbar'; import HTMLReactParser from 'html-react-parser'; import { text } from './data.js'; import NavigationList from './NavigationList.js'; class App extends React.Component { constructor() { super(); this.openedStateRadioButtons = ['push', 'shrink', 'overlap']; this.positionRadioButtons = ['top', 'bottom']; this.revealModeRadioButtons = ['slide', 'expand']; this.state = { opened: false, openedStateMode: 'shrink', revealMode: 'expand', position: 'top' }; this.toolbarItems = [{ widget: 'dxButton', location: 'before', options: { icon: 'menu', onClick: () => this.setState({ opened: !this.state.opened }) } }]; this.onOpenedStateModeChanged = this.onOpenedStateModeChanged.bind(this); this.onRevealModeChanged = this.onRevealModeChanged.bind(this); this.onPositionChanged = this.onPositionChanged.bind(this); this.onOutsideClick = this.onOutsideClick.bind(this); } onOpenedStateModeChanged({ value }) { this.setState({ openedStateMode: value }); } onRevealModeChanged({ value }) { this.setState({ revealMode: value }); } onPositionChanged({ value }) { this.setState({ position: value }); } onOutsideClick() { this.setState({ opened: false }); } render() { const { opened, openedStateMode, position, revealMode } = this.state; return ( <React.Fragment> <Toolbar items={this.toolbarItems} /> <Drawer opened={opened} closeOnOutsideClick={this.onOutsideClick} openedStateMode={openedStateMode} position={position} component={NavigationList} revealMode={revealMode} height={400} maxSize={200}> <div id="content" className="dx-theme-background-color"> {HTMLReactParser(text)} </div> </Drawer> <div className="options"> <div className="caption">Options</div> <div className="option"> <label>Opened state mode</label> <RadioGroup items={this.openedStateRadioButtons} layout="horizontal" value={openedStateMode} onValueChanged={this.onOpenedStateModeChanged} /> </div> {' '} <div className="option"> <label>Position</label> <RadioGroup items={this.positionRadioButtons} layout="horizontal" value={position} onValueChanged={this.onPositionChanged} /> </div> {' '} {openedStateMode !== 'push' && (<div className="option"> <label>Reveal mode</label> <RadioGroup items={this.revealModeRadioButtons} layout="horizontal" value={revealMode} onValueChanged={this.onRevealModeChanged} /> </div>)} </div> </React.Fragment> ); } } export default App;
import React from 'react'; import ReactDOM from 'react-dom'; import App from './App.js'; ReactDOM.render( <App />, document.getElementById('app') );
<!DOCTYPE html> <html> <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" /> <link rel="stylesheet" type="text/css" href="" /> <link rel="stylesheet" type="text/css" href="" /> <link rel="stylesheet" type="text/css" href="styles.css" /> <script src=""></script> <script src=""></script> <script type="text/javascript" src="config.js"></script> <script type="text/javascript"> System.import('./index.js'); </script> </head> <body class="dx-viewport"> <div class="demo-container"> <div id="app"></div> </div> </body> </html>
.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; }
export const navigation = [ { id: 1, text: 'Products' }, { id: 2, text: 'Sales' }, { id: 3, text: 'Customers' }, { id: 4, text: 'Employees' }, { id: 5, text: 'Reports' } ]; export 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>';
window.config = { transpiler: 'plugin-babel', meta: { 'devextreme/localization.js': { "esModule": true }, }, paths: { 'npm:': '' }, defaultExtension: 'js', map: { 'react': 'npm:react@17.0.2/umd/react.development.js', 'react-dom': 'npm:react-dom@17.0.2/umd/react-dom.development.js', 'prop-types': 'npm:prop-types@15.7.2/prop-types.js', 'html-react-parser': 'npm:html-react-parser@1.3.0/dist/html-react-parser.min.js', 'rrule': 'npm:rrule@2.6.6/dist/es5/rrule.js', 'luxon': 'npm:luxon@1.28.0/build/global/luxon.min.js', 'es6-object-assign': 'npm:es6-object-assign@1.1.0', 'devextreme': 'npm:devextreme@21.1.6/cjs', 'devextreme-react': 'npm:devextreme-react@21.1.6', 'jszip': 'npm:jszip@3.7.1/dist/jszip.min.js', 'devextreme-quill': 'npm:devextreme-quill@1.4.2/dist/dx-quill.min.js', 'devexpress-diagram': 'npm:devexpress-diagram@2.1.32/dist/dx-diagram.js', 'devexpress-gantt': 'npm:devexpress-gantt@3.0.14/dist/dx-gantt.js', '@devextreme/vdom': 'npm:@devextreme/vdom@1.2.2', 'inferno': 'npm:inferno@7.4.10/dist/inferno.min.js', 'inferno-compat': 'npm:inferno-compat@7.4.10/dist/inferno-compat.min.js', 'inferno-create-element': 'npm:inferno-create-element@7.4.10/dist/inferno-create-element.min.js', 'inferno-dom': 'npm:inferno-dom@1.0.7/dist/inferno-dom.min.js', 'inferno-hydrate': 'npm:inferno-hydrate@7.4.10/dist/inferno-hydrate.min.js', 'inferno-clone-vnode': 'npm:inferno-clone-vnode@7.4.10/dist/inferno-clone-vnode.min.js', 'inferno-create-class': 'npm:inferno-create-class@7.4.10/dist/inferno-create-class.min.js', 'inferno-extras': 'npm:inferno-extras@7.4.10/dist/inferno-extras.min.js', // SystemJS plugins 'plugin-babel': 'npm:systemjs-plugin-babel@0.0.25/plugin-babel.js', 'systemjs-babel-build': 'npm:systemjs-plugin-babel@0.0.25/systemjs-babel-browser.js' }, packages: { 'devextreme': { defaultExtension: 'js' }, '@devextreme/vdom': { defaultExtension: 'js' }, 'devextreme-react': { main: 'index.js' }, 'devextreme/events/utils': { main: 'index' }, 'devextreme/events': { main: 'index' }, 'es6-object-assign': { main: './index.js', defaultExtension: 'js' } }, packageConfigPaths: [ "npm:@devextreme/*/package.json", ], babelOptions: { sourceMaps: false, stage0: true, react: true } }; System.config(window.config);