/ Tabs / How To / Reorder Active Tab
Search results

Reorder Active Tab in Angular Tabs component

21 Dec 2022 / 6 minutes to read

We can able to prevent the changing of the active tab item on resizing the browser when overflow mode is popup by using the reorderActiveTab property. By default, the active Tab should be reordered when we click the tab items from the popup. If we set false to reorderActiveTab property the active tab item from the popup will not be reordered and an active item is highlighted inside the popup. The following code example depicts to prevent the reorder active tab item inside the popup.

Copied to clipboard
import { Component, OnInit } from '@angular/core';
import { Tab, TabComponent} from '@syncfusion/ej2-angular-navigations';

/**
 * Add nested Tabs
 */

@Component({
    selector: 'app-container',
 template: `
        <ejs-tab id="element" #tab [items]='tabItems' overflowMode='Popup'
        heightAdjustMode='Auto' [reorderActiveTab]='reorderActiveTab'>
        </ejs-tab>`,
})
export class AppComponent implements OnInit {
  public tabItems: Object[];

  public ngOnInit(): void {
    this.reorderActiveTab = false;
    this.tabItems = [
      {
        header: { text: 'India' },
        content:
          'India officially the Republic of India, is a country in South Asia. It is the seventh-largest country by area, the second-most populous country with over 1.2 billion people, and the most populous democracy in the world. Bounded by the Indian Ocean on the south, the Arabian Sea on the south-west, and the Bay of Bengal on the south-east, it shares land borders with Pakistan to the west;China, Nepal, and Bhutan to the north-east; and Burma and Bangladesh to the east. In the Indian Ocean, India is in the vicinity of Sri Lanka and the Maldives; in addition, India Andaman and Nicobar Islands share a maritime border with Thailand and Indonesia.',
      },
      {
        header: { text: 'Canada' },
        content:
          'Canada is a North American country stretching from the U.S. in the south to the Arctic Circle in the north. Major cities include massive Toronto, west coast film centre Vancouver, French-speaking Montréal and Québec City, and capital city Ottawa. Canada vast swaths of wilderness include lake-filled Banff National Park in the Rocky Mountains. It also home to Niagara Falls, a famous group of massive waterfalls.',
      },
      {
        header: { text: 'Australia' },
        content:
          "Australia, officially the Commonwealth of Australia, is a country comprising the mainland of the Australian continent, the island of Tasmania and numerous smaller islands. It is the world sixth-largest country by total area. Neighboring countries include Indonesia, East Timor and Papua New Guinea to the north; the Solomon Islands, Vanuatu and New Caledonia to the north-east; and New Zealand to the south-east.  <br/><br/>India is a vast South Asian country with diverse terrain – from Himalayan peaks to Indian Ocean coastline – and history reaching back 5 millennia. In the north, Mughal Empire and marks include Delhi's Red Fort complex and massive Jama Masjid mosque, plus Agras iconic Taj Mahal mausoleum. Pilgrims bathe in the Ganges in Varanasi, and Rishikesh is a yoga centre  and base for Himalayan trekking.",
      },
      {
        header: { text: 'USA' },
        content:
          'The United States of America (USA or U.S.A.), commonly called the United States (US or U.S.) and America, is a federal republic consisting of fifty states and a federal district. The 48 contiguous states and the federal district of Washington, D.C. are in central North America between Canada and Mexico. The state of Alaska is west of Canada and east of Russia across the Bering Strait, and the state of Hawaii is in the mid-North Pacific. The country also has five populated and nine unpopulated territories in the Pacific and the Caribbean.',
      },
      {
        header: { text: 'London' },
        content:
          'London, the capital of England and the United Kingdom, is a 21st-century city with history stretching back to Roman times. At its centre stand the imposing Houses of Parliament, the iconic ‘Big Ben’ clock tower and Westminster Abbey, site of British monarch coronations. Across the Thames River, the London Eye observation wheel provides panoramic views of the South Bank cultural complex, and the entire city.',
      },
      {
        header: { text: 'Germany' },
        content:
          'Germany is a Western European country with a landscape of forests, rivers, mountain ranges and North Sea beaches. It has over 2 millennia of history. Berlin, its capital, is home to art and nightlife scenes, the Brandenburg Gate and many sites relating to WWII. Munich is known for its Oktoberfest and beer halls, including the 16th-century Hofbräuhaus. Frankfurt, with its skyscrapers, houses the European Central Bank.',
      },
      {
        header: { text: 'France' },
        content:
          'France, officially the French Republic is a sovereign state comprising territory in western Europe and several overseas regions and territories. The European part of France, called Metropolitan France, extends from the Mediterranean Sea to the English Channel and the North Sea, and from the Rhine to the Atlantic Ocean; France covers 640,679 square kilo metres and as of August 2015 has a population of 67 million, counting all the overseas departments and territories.',
      },
      {
        header: { text: 'Sweden' },
        content:
          'Sweden is a Scandinavian nation with thousands of coastal islands and inland lakes, along with vast boreal forests and glaciated mountains. Its principal cities, eastern capital Stockholm and southwestern Gothenburg and Malmö, are all coastal. Stockholm is built on 14 islands. It has more than 50 bridges, as well as the medieval old town, Gamla Stan, royal palaces and museums such as open-air Skansen.',
      },
      {
        header: { text: 'Africa' },
        content:
          'Africa is the world second-largest and second-most-populous continent. At about 30.3 million km² including adjacent islands, it covers 6% of Earth total surface area and 20.4% of its total land area',
      },
      {
        header: { text: 'Japan' },
        content:
          'Japan is an island nation in the Pacific Ocean with dense cities, imperial palaces, mountainous national parks and thousands of shrines and temples. Shinkansen bullet trains connect the main islands of Kyushu, Honshu (home to Tokyo and Hiroshima’s atomic-bomb memorial) and Hokkaido (famous for skiing). Tokyo, the capital, is known for skyscrapers, shopping and pop culture.',
      },
      {
        header: { text: 'Malaysia' },
        content:
          'Malaysia is a Southeast Asian country occupying parts of the Malay Peninsula and the island of Borneo. It known for its beaches, rainforests and mix of Malay, Chinese, Indian and European cultural influences. The capital, Kuala Lumpur, is home to colonial buildings, busy shopping districts such as Bukit Bintang and skyscrapers such as the iconic, 451m-tall Petronas Twin Towers.',
      },
      {
        header: { text: 'Singapore' },
        content:
          'Singapore, an island city-state off southern Malaysia, is a global financial center with a tropical climate and multicultural population. Its colonial core centers on the Padang, a cricket field since the 1830s and now flanked by grand buildings such as City Hall, with its 18 Corinthian columns. In Singapore circa-1820 Chinatown stands the red-and-gold Buddha Tooth Relic Temple, said to house one of Buddha teeth.',
      },
    ];
  }
}
Copied to clipboard
import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { FormsModule } from '@angular/forms';
import { AppComponent } from './app.component';
import { TabModule } from '@syncfusion/ej2-angular-navigations';
/**
 * Module
 */
@NgModule({
    imports: [
        BrowserModule, FormsModule, TabModule
    ],
    declarations: [AppComponent],
    bootstrap: [AppComponent]
})
export class AppModule { }
Copied to clipboard
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
import { enableProdMode } from '@angular/core';
import { AppModule } from './app.module';

enableProdMode();
platformBrowserDynamic().bootstrapModule(AppModule);
Copied to clipboard
#loader {
  color: #008cff;
  height: 40px;
  left: 45%;
  position: absolute;
  top: 45%;
  width: 30%;
}

.e-content .e-item {
  font-size: 12px;
  margin: 10px;
  text-align: justify;
}
Copied to clipboard
export let tab_items: Object[] = [
    {
      header: { 'text': 'Twitter' },
      content: 'Twitter is an online social networking service that enables users to send and read short 140-character ' +
      'messages called "tweets". Registered users can read and post tweets, but those who are unregistered can only read ' +
      'them. Users access Twitter through the website interface, SMS or mobile device app Twitter Inc. is based in San ' +
      'Francisco and has more than 25 offices around the world. Twitter was created in March 2006 by Jack Dorsey, ' +
      'Evan Williams, Biz Stone, and Noah Glass and launched in July 2006. The service rapidly gained worldwide popularity, ' +
      'with more than 100 million users posting 340 million tweets a day in 2012.The service also handled 1.6 billion ' +
      'search queries per day.'
    },
    {
      header: { 'text': 'Facebook' },
      content: 'Facebook is an online social networking service headquartered in Menlo Park, California. Its website was ' +
      'launched on February 4, 2004, by Mark Zuckerberg with his Harvard College roommates and fellow students Eduardo ' +
      'Saverin, Andrew McCollum, Dustin Moskovitz and Chris Hughes.The founders had initially limited the website\'\s ' +
      'membership to Harvard students, but later expanded it to colleges in the Boston area, the Ivy League, and Stanford ' +
      'University. It gradually added support for students at various other universities and later to high-school students.'
    },
    {
      header: { 'text': 'WhatsApp' },
      content: 'WhatsApp Messenger is a proprietary cross-platform instant messaging client for smartphones that operates ' +
      'under a subscription business model. It uses the Internet to send text messages, images, video, user location and ' +
      'audio media messages to other users using standard cellular mobile numbers. As of February 2016, WhatsApp had a user ' +
      'base of up to one billion,[10] making it the most globally popular messaging application. WhatsApp Inc., based in ' +
      'Mountain View, California, was acquired by Facebook Inc. on February 19, 2014, for approximately US$19.3 billion.'
    }
];

export let nested_tab_items: Object[] = [
  {
    header: { 'text': 'USA' },
    content: '<div id="usa_tab"></div>'
  },
  {
    header: { 'text': 'France' },
    content: '<div id="france_tab"></div>'
  },
  {
    header: { 'text': 'Australia' },
    content: '<div id="australia_tab"></div>'
  }
];

export let usa_items: Object[] = [
  {
    header: { 'text': 'New York' },
    content: 'New York City comprises 5 boroughs sitting where the Hudson River meets the Atlantic Ocean. At its core is Manhattan, a densely populated borough that’s among the world’s major commercial, financial and cultural centers. Its iconic sites include skyscrapers such as the Empire State Building and sprawling Central Park. Broadway theater is staged in neon-lit Times Square.'
  },
  {
    header: { 'text': 'Los Angeles' },
    content: 'Los Angeles is a sprawling Southern California city and the center of the nation’s film and television industry. Near its iconic Hollywood sign, studios such as Paramount Pictures, Universal and Warner Brothers offer behind-the-scenes tours. On Hollywood Boulevard, TCL Chinese Theatre displays celebrities’ hand- and footprints, the Walk of Fame honors thousands of luminaries and vendors sell maps to stars’ homes.'
  },
  {
    header: { 'text': 'Chicago' },
    content: 'Chicago, on Lake Michigan in Illinois, is among the largest cities in the U.S. Famed for its bold architecture, it has a skyline punctuated by skyscrapers such as the iconic John Hancock Center, 1,451-ft. Willis Tower (formerly the Sears Tower) and the neo-Gothic Tribune Tower. The city is also renowned for its museums, including the Art Institute of Chicago with its noted Impressionist and Post-Impressionist works.'
  }
];

export let france_items: Object[] = [
  {
    header: { 'text': 'Paris' },
    content: 'Paris, France capital, is a major European city and a global center for art, fashion, gastronomy and culture. Its 19th-century cityscape is crisscrossed by wide boulevards and the River Seine. Beyond such landmarks as the Eiffel Tower and the 12th-century, Gothic Notre-Dame cathedral, the city is known for its cafe culture and designer boutiques along the Rue du Faubourg Saint-Honoré.'
  },
  {
    header: { 'text': 'Marseille' },
    content: 'Marseille, a port city in southern France, has been a crossroads of immigration and trade since its founding by the Greeks circa 600 B.C. At its heart is the Vieux-Port (Old Port), where fishmongers sell their catch along the boat-lined quay. Basilique Notre-Dame-de-la-Garde is a Romanesque-Byzantine church. Modern landmarks include Le Corbusier’s influential Cité Radieuse complex and Zaha Hadid’s CMA CGM Tower.'
  },
  {
    header: { 'text': 'Lyon' },
    content: 'Lyon, the capital city in France’s Auvergne-Rhône-Alpes region, sits at the junction of the Rhône and Saône rivers. Its center reflects 2,000 years of history from the Roman Amphithéâtre des Trois Gaules, medieval and Renaissance architecture in Vieux (Old) Lyon, to the modern Confluence district on Presquîle peninsula. Traboules, covered passageways between buildings, connect Vieux Lyon and La Croix-Rousse hill.'
  }
];

export let australia_items: Object[] = [
  {
    header: { 'text': 'Sydney' },
    content: 'Sydney, capital of New South Wales and one of Australia largest cities, is best known for its harbourfront Sydney Opera House, with a distinctive sail-like design. Massive Darling Harbour and the smaller Circular Quay port are hubs of waterside life, with the arched Harbour Bridge and esteemed Royal Botanic Garden nearby. Sydney Tower’s outdoor platform, the Skywalk, offers 360-degree views of the city and suburbs.'
  },
  {
    header: { 'text': 'Melbourne' },
    content: 'Melbourne is the coastal capital of the southeastern Australian state of Victoria. At the city centre is the modern Federation Square development, with plazas, bars, and restaurants by the Yarra River. In the Southbank area, the Melbourne Arts Precinct is the site of Arts Centre Melbourne – a performing arts complex – and the National Gallery of Victoria, with Australian and indigenous art.'
  },
  {
    header: { 'text': 'Brisbane' },
    content: 'Brisbane, capital of Queensland, is a large city on the Brisbane River. Clustered in its South Bank cultural precinct are the Queensland Museum and Sciencentre, with noted interactive exhibitions. Another South Bank cultural institution is Queensland Gallery of Modern Art, among Australia major contemporary art museums. Looming over the city is Mt. Coot-tha, site of Brisbane Botanic Gardens.'
  }
];