Angular Tabs Component

The Tabs component for Angular. The Tabs is breaking the content into multiple sections. You can populate it from 'LI' elements for the tab titles and 'DIV' elements for tab contents.

1. Installation

The easiest way to get started with jQWidgets UI for Angular is to use the Angular CLI Tool. To scaffold your project structure, follow its installation instructions.

npm install -g @angular/cli
ng new jqwidgets-project
cd jqwidgets-project

Install jQWidgets

jQWidgets Angular UI comes packaged with Angular CLI schematics to make creating Angular applications easier. Schematics are included with both @angular/cdk and jqwidgets-ng. Once you install the npm packages, they will be available through the Angular CLI.

Angular CLI supports the addition of packages through the ng add command. The ng add command provides faster and more user-friendly package installation. To install the jQWidgets UI for Angular package, use ng add and add the name of the NPM package:

ng add jqwidgets-ng

Alternatively, you can use the standard installation (Manual Setup)

jQWidgets UI for Angular is distributed as jqwidgets-ng NPM package

  1. Download and install the package.
    npm install jqwidgets-ng
  2. Adding CSS reference

    The following CSS file is available in ../node_modules/jqwidgets-ng/ package folder. This can be referenced in [src/styles.css] using following code.

    @import 'jqwidgets-ng/jqwidgets/styles/jqx.base.css';

    Another way to achieve the same is to edit the angular.json file and in the styles add the style.

    "styles": [
    	"node_modules/jqwidgets-ng/jqwidgets/styles/jqx.base.css"
    ]
    

2. Add the HTML for jQWidgets component in src/app/app.component.html

app.component.html


<jqxTabs [theme]="'fluent'" #tabsReference
         [width]='"90%"' [height]='200' [position]='"top"'
         [animationType]='"none"' [selectionTracker]='false'>
  <ul>
    <li style="margin-left: 30px;">Node.js</li>
    <li>JavaServer Pages</li>
    <li>Active Server Pages</li>
    <li>Python</li>
    <li>Perl</li>
  </ul>
  <div>
    Node.js is an event-driven I/O server-side JavaScript environment based on V8. It
    is intended for writing scalable network programs such as web servers. It was created
    by Ryan Dahl in 2009, and its growth is sponsored by Joyent, which employs Dahl.
    Similar environments written in other programming languages include Twisted for
    Python, Perl Object Environment for Perl, libevent for C and EventMachine for Ruby.
    Unlike most JavaScript, it is not executed in a web browser, but is instead a form
    of server-side JavaScript. Node.js implements some CommonJS specifications. Node.js
    includes a REPL environment for interactive testing.
  </div>
  <div>
    JavaServer Pages (JSP) is a Java technology that helps software developers serve
    dynamically generated web pages based on HTML, XML, or other document types. Released
    in 1999 as Sun's answer to ASP and PHP,[citation needed] JSP was designed to address
    the perception that the Java programming environment didn't provide developers with
    enough support for the Web. To deploy and run, a compatible web server with servlet
    container is required. The Java Servlet and the JavaServer Pages (JSP) specifications
    from Sun Microsystems and the JCP (Java Community Process) must both be met by the
    container.
  </div>
  <div>
    ASP.NET is a web application framework developed and marketed by Microsoft to allow
    programmers to build dynamic web sites, web applications and web services. It was
    first released in January 2002 with version 1.0 of the .NET Framework, and is the
    successor to Microsoft's Active Server Pages (ASP) technology. ASP.NET is built
    on the Common Language Runtime (CLR), allowing programmers to write ASP.NET code
    using any supported .NET language. The ASP.NET SOAP extension framework allows ASP.NET
    components to process SOAP messages.
  </div>
  <div>
    Python is a general-purpose, high-level programming language[5] whose design philosophy
    emphasizes code readability. Python claims to "[combine] remarkable power with very
    clear syntax",[7] and its standard library is large and comprehensive. Its use of
    indentation for block delimiters is unique among popular programming languages.
    Python supports multiple programming paradigms, primarily but not limited to object-oriented,
    imperative and, to a lesser extent, functional programming styles. It features a
    fully dynamic type system and automatic memory management, similar to that of Scheme,
    Ruby, Perl, and Tcl. Like other dynamic languages, Python is often used as a scripting
    language, but is also used in a wide range of non-scripting contexts.
  </div>
  <div>
    Perl is a high-level, general-purpose, interpreted, dynamic programming language.
    Perl was originally developed by Larry Wall in 1987 as a general-purpose Unix scripting
    language to make report processing easier. Since then, it has undergone many changes
    and revisions and become widely popular amongst programmers. Larry Wall continues
    to oversee development of the core language, and its upcoming version, Perl 6. Perl
    borrows features from other programming languages including C, shell scripting (sh),
    AWK, and sed.[5] The language provides powerful text processing facilities without
    the arbitrary data length limits of many contemporary Unix tools, facilitating easy
    manipulation of text files.
  </div>
</jqxTabs>	

3. Setup Component Logic

app.component.ts


import { Component, ViewChild, ViewEncapsulation } from '@angular/core';


import { jqxTabsModule, jqxTabsComponent } from 'jqwidgets-ng/jqxtabs';
@Component({
    selector: 'app-root',
    imports: [jqxTabsModule],
    standalone: true,
    templateUrl: './app.component.html',
    styleUrls: ['./app.component.css'],
    encapsulation: ViewEncapsulation.None
})

export class AppComponent {
    @ViewChild('tabsReference') myTabs: jqxTabsComponent;

    onChangeAnimation(event: any): void {
        let checked = event.args.checked;
        this.myTabs.selectionTracker(checked);
    }
    onChangeContentAnimation(event: any): void {
        let checked = event.args.checked;
        if (checked) {
            this.myTabs.animationType('fade');
        }
        else {
            this.myTabs.animationType('none');
        }
    }
}

Summary

jQWidgets UI for Angular provides an easy way to integrate robust UI components into your Angular project. By using either the ng add command or manual setup, you can quickly get started. Once the setup is complete, you can add the desired jQWidgets components and configure them in your Angular components to match your application requirements.

Tabs API

API Reference of the jQWidgets Tabs component for Angular: Tabs API