Button types

2 Nov 20172 minutes to read

Toggle Button is used as normal click able button, submitting form data, resetting the form data to its initial value. According to the usage of button, you can render the Toggle Button in the following three types by using the type property.

Toggle Button Types

Button Type Description
button The button is a click able button
submit The button is a submit button (submits form-data)
reset The button is a reset button (resets the form-data to its initial values)

The following steps explains you the details about rendering the Toggle Button with above mentioned types.

In the HTML page, add the following button elements to configure Toggle Button widget.

  • HTML
  • <div align="center">
        <table width="500px" align="center"> 
             <tr>
                 <td> Normal</td>
                 <td colspan="2">
                     <ej-togglebutton type="checkbox" id="type_button"  size="large" defaultText="Play" activeText="Pause"></ej-togglebutton>
                 </td>
             </tr>
             <tr>
                 <td> Mini</td>
                 <td colspan="2">
                     <ej-togglebutton type="checkbox" id="type_submit"  defaultText="submit" size="large" activeText="submitted" ></ej-togglebutton>
                 </td>
             </tr>
             <tr>
                 <td> Small</td>
                 <td colspan="2">
                     <ej-togglebutton type="checkbox" id="type_mini"  defaultText="reset" size="large" activeText="reseted" ></ej-togglebutton>
                 </td>
             </tr>
         </table>
        </div>
  • HTML
  • import { Component } from '@angular/core';
    @Component({
        selector: 'ej-app',
        templateUrl: './togglebutton.component.html'
    })
    export class ToggleButtonComponent {
        constructor() {
        }
    }

    Execute the above code to render the following output.