Ext.js - Font-Awesome Triton Theme



With the Triton theme, we do not need any explicit requirement of font-awesome stylesheet. We can directly use font-awesome classes as font-awesome is included in the Triton theme inbuilt.

Syntax

Just add font-awesome class to iconCls as −

iconCls : 'fa fa-car'

Example

Following is a simple example to add font-awesome class.

<!DOCTYPE html>
<html>
   <head>
      <link href = "https://cdnjs.cloudflare.com/ajax/libs/extjs/6.0.0/classic/theme-triton/resources/theme-triton-all.css" 
         rel = "stylesheet" />
      <script type = "text/javascript" 
         src = "https://cdnjs.cloudflare.com/ajax/libs/extjs/6.0.0/ext-all.js"></script>
      
      <script type = "text/javascript">
         Ext.onReady(function() {
            Ext.create('Ext.container.Container', {
               renderTo : Ext.getBody(),
               layout : 'auto' ,
               width : 600,
               
               items : [{
                  xtype	: 'button',
                  iconCls	: 'fa fa-car',
                  text	: 'Browse Fil1e'
               },{
                  xtype	: 'button',
                  iconCls	: 'fa fa-file',
                  text	: 'Browse File3'
               },{
                  xtype	: 'button',
                  iconCls	: 'fa fa-home',
                  text	: 'Browse File4'
               },{
                  xtype	: 'button',
                  iconCls	: 'fa fa-folder',
                  text	: 'Browse File5'
               }]
            });
         });
      </script>
   </head>
   
   <body>
      <div id = "panel" > </div>
   </body>
</html>

The above program will produce the following result −

extjs_fonts.htm
Advertisements