Properties Methods Events Config Options Direct Link
Observable
  Component
    Component
      Button

Class Ext.Button

Package:Ext
Defined In:Button.js
Class:Button
Subclasses:Tab
Extends:Component

A simple class to display different styles of buttons.

Useful Properties

Useful Methods

Screenshot:

Example code:

// an array of buttons (using xtypes) to be included in the panel below
var buttons = [
    {
        text: 'Normal'
    },
    {
        ui  : 'round',
        text: 'Round'
    },
    {
        ui  : 'small',
        text: 'Small'
    }
];

var panel = new Ext.Panel({
    layout: {
        type : 'vbox',
        pack : 'center',
        align: 'stretch'
    },
    defaults: {
        layout: {
            type: 'hbox'
        },
        flex: 1,
        defaults: {
            xtype: 'button',
            cls  : 'demobtn',
            flex : 1
        }
    },
    items: [
        {
            items: buttons // buttons array defined above
        },
        {
            items: [
                new Ext.Button({
                    ui  : 'decline',
                    text: 'Drastic'
                }),
                {
                    ui  : 'decline-round',
                    text: 'Round'
                },
                {
                    ui  : 'decline-small',
                    text: 'Small'
                }
            ]
        },
        {
            items: [
                {
                    ui  : 'confirm',
                    text: 'Confirm'
                },
                {
                    ui  : 'confirm-round',
                    text: 'Round'
                },
                {
                    ui  : 'confirm-small',
                    text: 'Small'
                }
            ]
        }
    ]
});

Config Options

Config OptionsDefined By
 autoEvent : String/Object
If provided, a handler function is automatically created that fires the given event in the configured scope.
Button
 badgeCls : String
CSS class for badge Defaults to 'x-badge'
Button
 badgeText : String
The text to be used for a small badge on the button. Defaults to ''
Button
 baseCls : String
Base CSS class Defaults to 'x-button'
Button
 centered : Boolean
Center the Component. Defaults to false.
Component
 cls : String
A CSS class string to apply to the button's main element.
Button
 componentCls : String
CSS Class to be added to a components root level element to give distinction to it via styling.
Component
 data : Mixed
The initial set of data to apply to the tpl to update the content area of the Component.
Component
 disabled : Boolean
True to start disabled (defaults to false)
Button
 disabledCls : String
CSS class to add when the Component is disabled. Defaults to 'x-item-disabled'.
Component
 draggable : Boolean
Allows the component to be dragged via the touch event.
Component
 floating : Boolean
Create the Component as a floating and use absolute positioning. Defaults to false.
Component
 floatingCls : Boolean
The class that is being added to this component when its floating. (defaults to x-floating)
Component
 height : Number
The height of this component in pixels.
Component
 hidden : Boolean
True to start hidden (defaults to false)
Button
 iconCls : String
A css class which sets a background image to be used as the icon for this button
Button
 iconMask : Boolean
Whether or not to mask the icon with the iconMaskCls configuration. Defaults to false.
Button
 iconMaskCls : String
CSS class to be added to the iconEl when the iconMask config is set to true. Defaults to 'x-icon-mask'
Button
 monitorOrientation : Boolean
Monitor Orientation change
Component
 pressedCls : String
CSS class when the button is in pressed state Defaults to 'x-button-pressed'
Button
 scope : Object
The scope (this reference) in which the handler and toggleHandler is executed. Defaults to this Button.
Button
 stopMaskTapEvent : Boolean
True to stop the event that fires when you click outside the floating component. Defalts to true.
Component
 styleHtmlCls : String
The class that is added to the content target when you set styleHtmlContent to true. Defaults to 'x-html'
Component
 text : String
The button text to be used as innerHTML (html tags are accepted)
Button
 width : Number
The width of this component in pixels.
Component

Public Properties

PropertyDefined By
 draggable : Boolean
Read-only property indicating whether or not the component can be dragged
Component
 rendered : Boolean
Read-only property indicating whether or not the component has been rendered.
Component

Public Methods

MethodDefined By

Public Events

EventDefined By