Try the new tool ReExt, now available! Learn More

UI Components by Ext JS to Create A Stunning Mobile App

September 24, 2024 2873 Views

UI Components by Ext JS to Create A Stunning Mobile App

Designing useful and appealing applications is crucial, especially in business contexts. Sencha’s Ext JS offers a complete solution for this task by providing cross-platform support, easy development conditions, and rich media integration. With more than 140 fully functional UI components, including navigational components and form layouts, developers can create applications without compromising on design and usability. These UI components are essential for building apps that are easy to use while effectively handling complicated data.

The purpose of this blog is to guide you in creating a mobile application using Ext JS. You will utilize key UI components, including navigational components, to streamline the development process. Ext mobile application development has several advantages, which we will discuss in detail. Additionally, we will cover how to set up your development environment.

Following that, we will explain the procedure for creating a simple mobile application. This will include steps such as adding essential UI components like grids and search fields to enhance application efficiency. We will also address best practices for UI designers when incorporating rich media and form layouts into applications. Each step focuses on improving overall application performance. Let’s get started!

Two developers collaborating on designing a mobile app using Ext JS UI components, illustrated with coding and app interface elements.

What Are UI Components?

Each software application consists of UI components that are essential for user interaction. These components, such as search fields and input fields, are distinct yet interconnected, helping developers and UI designer create interactive activities. For instance, buttons, text boxes, checkboxes, sliding bars, and drop-down menus are commonly used and can be modified or reused across different proceeding pages, ensuring design uniformity while adapting functionality.

Graphical user interfaces (GUIs) are often organized into designs or libraries that contain ready-to-use components within the same design system. Examples include Material-UI for React and Bootstrap for web development. Utilizing these libraries speeds up the development process and solves issues related to design consistency.

UI components also make it easier for users to interact with the software by allowing them to browse, input field data, and trigger a particular action. They enhance the user experience by ensuring the application is intuitive and user-friendly, regardless of the user’s current location within the app. The ease of interaction reduces frustration and enables a smoother workflow for users, providing them with a variety of functional possibilities.

What Is Ext JS?

Sencha Ext JS is a full-fledged software in JavaScript. It has all the essential tools to build complex web and mobile applications. With this, you can efficiently build apps that work on all modern devices. This means the apps you build with Ext JS will run on any device without issues.

There are more than 140 components to enhance your apps. UI components include buttons, checkboxes, and radio buttons. They also include text input fields and navigation components like sliders and icons. Information components like progress bars and tooltips are also available. In addition, it provides useful grids for designing applications with large amounts of data.

You can download usable aids developed by the Sencha community. The Ext JS ARIA package provides ARIA accessibility features for your apps. Other supportive tools for Ext JS include Sencha Cmd, Sencha Architect, Sencha Test, Sencha Stencils, and Sencha Themer.

Sencha Ext JS

Why Should I Use Ext JS UI Components To Create My Mobile App?

Ext JS offers all the basic UI elements and advanced components you need to create an efficient user interface and UI design. All these responsive and high-performance components are designed to work together flawlessly on any mobile app. 

Ext JS component library also has a layout manager that allows you to manage and control the display of data and components across different devices, screen sizes, and browsers. 

Additionally, the responsive config system allows the app components to adapt efficiently to a particular device orientation, such as landscape or portrait. Here are some of the most common UI elements offered by Ext JS:

Buttons

Buttons are basic UI components that allow users to perform different actions on a website, web, or mobile app. Buttons are typically designed using text and icons.

Date Picker

A date/month picker enables users to select a date and month. By using the date picker, we get consistently formatted information.

Ext JS UI components - Date picker

A date/month picker enables users to select a date and month. By using the date picker, we get consistently formatted information.

Grids

Data grids are an essential part of a data-driven mobile web app, such as an enterprise-grade app. These grids allow us to display data in an organized tabular format. Ext JS offers a wide range of grid features. For example, we can create grouped grids, add row numbers, add a group header, sort grids in ascending or descending order, and more.

Ext JS UI components - Grid component

Data grids are an essential part of a data-driven mobile web app, such as an enterprise-grade app. These grids allow us to display data in an organized tabular format. Ext JS offers a wide range of grid features. For example, we can create grouped grids, add row numbers, add a group header, sort grids in ascending or descending order, and more.

Drop-down List

Drop-down lists UI components enable users to choose one item at a time from the list. These lists are compact and save space. Ext JS allows you to customize the text in the dropdown menu and text fields to help users understand the necessary action.

Ext JS UI components - Dropdown list

Search Field

Users can use a search field or search box to enter text, such as a phase or keyword, and get the most relevant results. For example, if you have a search box in your e-commerce mobile app, users can search desired products using specific keywords. Ext JS offers many other elements, such as forms, progress bars, sliders, tabs, menus, and more.

What Are The Other Key Features Of Ext JS?

Back-end Agnostic Data Package

Ext JS has a powerful data package that decouples the UI components from the data layer. The data package helps with the collection of client-side data using highly functional models. It also offers features like sorting and filtering. Ext JS is also capable of accessing data from any back-end source.

Themes

In addition to high-performance UI components, Sencha offers multiple built-in themes for your apps. You can even customize the themes as per your app’s design.

Layouts

Ext JS offers a comprehensive set of flexible layouts. These layouts ensure the proper positioning and sizing of all components on different devices, screen sizes, and browsers.

Exporter

With Ext JS, you can export data from Pivot Grid or Standard Grid to several common formats, such as XSLX, HTML, Excel XML, and CSV.

Charts and D3

Charts and Data-Driven Documents package (D3) visualizations allow you to represent data visually and are an essential part of data-driven apps. Ext JS allows you to create different types of dynamic and static charts for your web and mobile apps. These include bar, area, line pie, column charts, and many other charts and graphs. Ext JS also enables you to add D3 visualizations, such as heatmaps, treemaps, and sunbursts, to your apps.

Stacked column Chart created using Ext JS

How To Create A Mobile App With Ext JS?

Step 1

First, we have to install packages from npm. Ext JS provides 30-day trial packages that users can install from public npm. You can use the command below to install the latest version of Ext JS:

 

$ npm install -g @sencha/ext-gen

 

If you’re an active user, Ext JS and all related packages will be hosted on Sencha’s private npm registry. You can use the following commands to log in to the registry and install npm:

 

$ npm login --registry=https://npm.sencha.com/ --scope=@sencha

$ npm install -g @sencha/ext-gen

 

Step 2

Next, we’ll generate a simple app (two-view) that consists of a home page and a grid: 

 

ext-gen app -a -t moderndesktop -n ModernApp

 

Step 3

Once our app is generated, we can change to that directory:

 

cd ./modern-app

 

To explore your app, use the following command:

 

npm start

 

Adding More UI Components To Your App

You can add any UI component to your app. Here, we’ll show you how to add a simple horizontal carousel to your app:   You can also find the code here. 

 

Ext.create('Ext.Carousel', {

fullscreen: true,

defaults: {

styleHtmlContent: true

},

items: [

{

html : 'Item 1',

style: 'background-color: #5E99CC'

},

{

html : 'Item 2',

style: 'background-color: #759E60'

},

{

html : 'Item 3'

}

]

});

 

The code above will generate the following Carousel:

A carousel created using Ext JS

Optimizing Performance for Ext JS Mobile App

Optimizing performance in Ext JS applications is critical. This ensures seamless and quick performance. Below are some techniques for performance optimization.

Optimized Data Request

Use paging or infinite scrolling to download data. This avoids retrieving everything at once. It reduces memory usage and speeds up load time. Use lazy loading to render elements only when needed.

Minification and Compression

Minification involves reducing file size without altering content. This is crucial for faster load times. Also, Gzip compression should be implemented on the server during data transfers.

Use Lightweight Components

Choose lightweight components when using Ext JS. Avoid heavy components unless absolutely necessary. This speeds up rendering and reduces resource usage.

Image Optimization

Images consume a lot of space, often unnecessarily. Optimize images without affecting quality. Use sprites or icon fonts for shapes and symbols instead.

Caching

Use caching to limit server calls. Frequently used data can be stored in localStorage or sessionStorage.

Event Throttling/Debouncing

Apply throttling to targeted events, especially for window scrolls and resizing. This minimizes how often a function is executed, improving performance.

Testing and Profiling

Regularly test on different devices. Use profiling tools to identify bottlenecks and areas for improvement. 

Testing Ext JS Applications with Sencha Tools

Sencha provides powerful tools for testing Ext JS applications. These tools cover both unit and end-to-end testing. Below are the steps and techniques for using Sencha Studio and other resources.

1. End-to-End Testing

End-to-end testing focuses on simulating the complete user experience in the application. Here’s how you can set it up in Sencha Studio:

Setup Project

Open Sencha Studio and create a new project. Define the URL where your Ext JS app is running (e.g., http://examples.sencha.com/extjs/latest/examples/admin-dashboard/).

Create Scenarios

Once the project is created, click on the “New Scenario” button to create a scenario that will hold your test suite files.

Name: For example, you can name the scenario “EndToEnd.”

Test type: Select WebDriver to run tests separately from the browser, which is ideal for end-to-end testing.

Create Jasmine Test Suite

After creating the scenario, click “New Test Suite” and select Jasmine Test Suite from the menu. This will generate a .js file for writing your tests.

You can now begin writing your tests, either manually or using the Event Recorder to capture actions. Here’s an example:

 

describe("formBind true", function() {

    it("should disable button if email is not valid", function(done) {

        

        // Create and reference the WindowEditor and then 

        // get reference to the button and textfield

        var win = Ext.create('MyApp.view.main.WindowEditor'),

            button = win.down('button'),      

            field  = win.down('textfield');

        

        // Set the field's value to a valid email address

        field.setValue('[email protected]');

        

        button.on('enable', function() {

            

            // Set the field's value to an invalid email address

            field.setValue('');

            

            button.on('disable', function() {

                // If button disables after invalid input, test passes

                done();

            });

        });

    });

});

 

This test verifies that the button is enabled when the form contains a valid email and disabled when the form is invalid.

2. Unit Testing

Unit testing focuses on smaller, individual parts of the application. Here’s how to set up unit testing:

Set up Project

Open Sencha Studio and generate your workspace. Create a new project and define where the Ext JS framework resides.

Add Testable Class

Add a new class to test. For example, the WindowEditor class contains a form with validation.

 

Ext.define('MyApp.view.main.WindowEditor', {

    extend: 'Ext.Window',

    alias: 'widget.windoweditor',

    width: 400,

    height: 200,

    padding: 20,

    autoShow: true,

    title: 'Update Email',

    items: [{

        xtype: 'form',

        items: [{

            xtype: 'textfield',

            allowBlank: false,

            vtype: 'email'

        },{

            xtype: 'button',

            text: 'Submit Change',

            formBind: true

        }]

    }]

});

 

Write Unit Test

Now, create a test to validate that the button remains disabled until the form is valid.

 

describe("form validation", function() {

    it("should enable button when form is valid", function() {

        

        // Create the window and reference form items

        var win = Ext.create('MyApp.view.main.WindowEditor'),

            button = win.down('button'),

            field = win.down('textfield');

        

        // Set valid email, expect button to be enabled

        field.setValue('[email protected]');

        expect(button.disabled).toBe(false);

        

        // Set invalid email, expect button to be disabled

        field.setValue('');

        expect(button.disabled).toBe(true);

    });

});

 

This test checks whether the button enables and disables based on the form’s validity.

3. Running Tests

Once you have your tests written, run them using the test runner in Sencha Studio:

Run End-to-End Tests

Select the test scenario (e.g., “WindowEditor”). In the left-hand panel, choose the browser (e.g., Chrome). Click “Run Selection” to execute the test.

Running Unit Tests

For unit tests, run the Jasmine Test Suite by clicking “Run Selection.” If successful, you will see green check marks indicating passed tests.

4. Debugging Failures

If a test fails, you will see a red “x” next to the test case. Clicking the red “x” reveals detailed error information in the summary panel. You can adjust your tests based on these errors.

For example, if the following code fails to enable the button:

 

field.setValue('[email protected]');

 

You may inspect if the form validation logic needs revision.

Sencha provides comprehensive tools for testing Ext JS applications. Using Sencha Test, WebDriver, and Jasmine, you can efficiently test both granular components and the complete user experience. 

What Are The Benefits Of Using Ext JS To Create Your Mobile Apps?

Some of the key benefits of using Ext JS for creating your mobile apps include:

Quick Development Process

Developers have access to more than 140 pre-built UI components. These components complement and work perfectly with each other. You don’t need to write the code for these components from scratch. Ext JS enhances the speed of web and mobile application development. It allows developers to minimize time and costs.

Cross-platform and Cross-Browser Functionality

Cross-platform development refers to creating an app with the same code for more than one platform. Cross-browser functionality means the app works on different web browsers. Ext JS enables the development of cross-platform mobile applications. These applications can run on several platforms and have cross-browser support.

All Ext JS applications work in most leading browsers. These include Safari 6+, Chrome, Opera 12+, and Firefox. It helps reduce time, costs, resources, and efforts. Developers don’t need to spend time customizing features for different platforms and browsers. They can focus on integrating features that all platforms and browsers can use. As HTML and CSS standards change, Ext JS adapts to accommodate these standards.

Sencha Customer Support

Sencha Ext JS has exceptional customer support. They promptly address customer queries. If you have a query, you can raise it through the forums. Your question will be addressed quickly. You may also send an email. Our team will provide a solution as soon as possible.

Conclusion

Ext JS offers a robust framework for creating high-performance mobile apps. It is especially suited for data-driven environments. The platform provides over 140 pre-built UI components. This allows developers to design user-friendly and cross-platform applications with ease. Its flexible layout management ensures smooth performance across devices and browsers. Ext JS integrates seamlessly with back-end data sources. It also supports advanced features like charts, grids, and accessibility.

The framework speeds up development processes. It enables faster app creation and reduces resource usage. Cross-platform functionality and strong customer support further enhance its effectiveness. With Ext JS, businesses can efficiently develop mobile apps that meet modern demands. This helps them save time and deliver high-quality apps.

Frequently Asked Questions (FAQs)

What are UI components?

UI components are the building blocks or key elements of a user interface. Some examples of user interface elements or UI components include buttons, message boxes, search fields, tab bars, progress bars, time pickers, and more.

How many UI components are there?

There are many different types of UI components, such as scrollbars, checkboxes, buttons, menu items, sliders, carousels, and more. You can use these UI elements depending on the requirements of your app.

What are the main elements of a user interface?

User interface elements are divided into four categories: input controls, navigation components, informational components, and containers. 

What is UI design, and why is it important?

UI design focuses on creating visually appealing, user-friendly interfaces to enhance user interaction and satisfaction.

Start using Sencha Ext JS today and build functional mobile apps quickly!

Sencha CTA Banner: Try Sencha Ext JS

Trusted by Top Developers: Learn how to enhance your development journey — for free

Get the latest newsletter keeping thousands of developers in the loop.

Loved by developers at