Your search did not match any results.
Button

Predefined Types

Documentation

This demo illustrates the predefined types of the Button widget. A Toast is displayed each time you click a Button.

Copy to CodeSandBox
Apply
Reset
import React from 'react'; import { Button } from 'devextreme-react'; import notify from 'devextreme/ui/notify'; class App extends React.Component { constructor(props) { super(props); } onClick(e) { const buttonText = e.component.option('text'); notify(`The ${buttonText} button was clicked`); } render() { const buttons = []; const baseOptions = [ { text: 'OK', type: 'normal' }, { text: 'Apply', type: 'success' }, { text: 'Done', type: 'default' }, { text: 'Delete', type: 'danger' } ]; const modes = [ 'contained', 'outlined', 'text' ]; modes.forEach(mode => { baseOptions.forEach(options => { const key = options.text + options.type + mode; buttons.push(<div key={`container${key}`}> <Button key={key} width={90} text={options.text} type={options.type} stylingMode={mode} onClick={this.onClick} /> </div>); }); }); return ( <div className={'buttons-demo'}> <div className={'header'}> <div></div> <div>Normal</div> <div>Success</div> <div>Default</div> <div>Danger</div> </div> <div className={'types'}> <div>Contained</div> <div>Outlined</div> <div>Text</div> </div> <div className={'buttons'}> {buttons} </div> </div> ); } } 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="https://cdn3.devexpress.com/jslib/19.1.5/css/dx.common.css" /> <link rel="stylesheet" type="text/css" href="https://cdn3.devexpress.com/jslib/19.1.5/css/dx.light.css" /> <link rel="stylesheet" type="text/css" href="styles.css" /> <script src="https://unpkg.com/core-js@2.4.1/client/shim.min.js"></script> <script src="https://unpkg.com/systemjs@0.21.3/dist/system.js"></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>
.demo-container { height: 450px; } #app { display: flex; justify-content: center; height: 100%; } .buttons-demo { width: 600px; align-self: center; } .header { display: flex; flex-wrap: nowrap; } .header > div { flex-grow: 0; flex-basis: 120px; height: 30px; } .types { width: 120px; display: flex; flex-direction: column; float: left; } .types > div { flex-grow: 1; padding: 10px; height: 30px; line-height: 20px; font-weight: bold; opacity: 0.7; } .buttons { display: flex; flex-wrap: wrap; margin-left: 120px; } .buttons > div { flex-basis: 120px; height: 50px; }
System.config({ transpiler: 'plugin-babel', paths: { 'npm:': 'https://unpkg.com/' }, defaultExtension: 'js', map: { 'react': 'npm:react@16/umd/react.development.js', 'react-dom': 'npm:react-dom@16/umd/react-dom.development.js', 'prop-types': 'npm:prop-types/prop-types.js', 'devextreme': 'npm:devextreme@19.1', 'devextreme-react': 'npm:devextreme-react@19.1', 'jszip': 'npm:jszip@3.1.3/dist/jszip.min.js', 'quill': 'npm:quill@1.3.6/dist/quill.js', 'devexpress-diagram': 'npm:devexpress-diagram', // SystemJS plugins 'plugin-babel': 'npm:systemjs-plugin-babel@0/plugin-babel.js', 'systemjs-babel-build': 'npm:systemjs-plugin-babel@0/systemjs-babel-browser.js' }, packages: { 'devextreme': { defaultExtension: 'js' }, 'devextreme-react': { main: 'index.js' } }, babelOptions: { sourceMaps: false, stage0: true, react: true } });