DevExtreme Vue - Customize the Appearance

The Button widget provides five predefined appearances controlled by the type option. The type can be "normal", "default", "back", "danger" or "success". Choose the proper type depending on the commands that the Button performs.

  • <template>
  • <dx-button
  • text="Click me"
  • @click="foo"
  • type="default" /> <!-- or "normal" | "back" | "danger" | "success" -->
  • </template>
  • <script>
  • import DxButton from "devextreme-vue/button";
  •  
  • export default {
  • components: {
  • DxButton
  • },
  • methods: {
  • foo: function(e) {
  • // ...
  • }
  • }
  • }
  • </script>

View Demo

Apart from plain text, the Button can display an icon. DevExtreme provides built-in icons that change their appearance depending on the platform. Alternatively, you can use an external icon library or standalone icons. To specify the icon, set the icon option.

  • <template>
  • <dx-button
  • text="Delete"
  • @click="foo"
  • type="danger"
  • icon="remove" />
  • </template>
  • <script>
  • import DxButton from "devextreme-vue/button";
  •  
  • export default {
  • components: {
  • DxButton
  • },
  • methods: {
  • foo: function(e) {
  • // ...
  • }
  • }
  • }
  • </script>

View Demo

If you need to define the Button content completely, implement a template for it using the template option as shown in the following example.

  • <template>
  • <dx-button
  • text="Refresh"
  • @click="foo"
  • template="buttonTemplate">
  • <i
  • slot="buttonTemplate"
  • slot-scope="buttonData"
  • style="color: green">
  • {{ buttonData.text }}
  • </i>
  • </dx-button>
  • </template>
  • <script>
  • import DxButton from "devextreme-vue/button";
  •  
  • export default {
  • components: {
  • DxButton
  • },
  • methods: {
  • foo: function(e) {
  • // ...
  • }
  • }
  • }
  • </script>
See Also