×

Ionic List

Ionic List

The ionic list is created of several rows of items that can contain text, buttons, thumbnails, keys, icons, and more. Lists are one of the essential components in any web or mobile app. It usually contains items with similar data content, such as images and text. Both the list that contains the items and the list items can be any HTML component.

Ionic lists support different interactions, such as the swiping item to reveal options, drag to rearrange items within the list, and delete items. We can access the lists using the standard <ion-list> element.

Creating Ionic List

Each list is created with two items. When you want to create the main list, the <ul> tag must contain the assigned list class, and the <li> tag will use the item class. Another interesting thing is that you don't even need to use <ul>, <ol> and <li> tags for your lists. You can use any other component, but the important thing is to add lists and classes of items correctly. In Basic usage, it is by default, all lists will be designed with divider lines.

The given syntax shows how to create a list in the ionic framework.

 
  
 item1 
 item2 
   
  

Output: After executing this code, you will get the output, as shown below.

Creating Ionic List

In the Ionic framework, there are different types of lists.

  • List Header
  • List Icon
  • List Dividers
  • Basic Lists
  • Inset Lists
  • Multi-Line List
  • Avatar List
  • Thumbnail List
  • Sliding List

List Header: Every ionic list can add a header at the top of the list. By using the <ion-list-header> component, you can add a list header.

Example: The below example shows how you can use the list header in the ionic application.

 
   
   
  Lists 
   
   
   
  
  Header
  A  
  B 
  C 
   

Output: After executing this code, you will get the output, as shown below.

List Header

List Icon: Include icons to the list provides a guide to the content of every item. We can also adjust the icon size, small or large. By default, the icon is small but can be enlarged using the large property. There is a <ion-note> component, which is a text component used as subheadings that provide more information.

Example: The below example shows how to add the icons in the ionic application.

  
   
   
  Lists 
   
   
   
    
   
   
   
   
   
   
   
    
   
   
   
   
   
   
    

Output: After executing this code, you will get the output, as shown below.

List Icon

List Dividers: To divide groups of items, use <ion-item-group> in place of <ion-list>. Use the <ion-item-divider> elements to divide the group into several sections.

Example: The below example shows how you can use the list dividers in the ionic application.

   
 
   
  Lists 
   
   
   
  
    
  
  A
  Apple
  Anaconda
  Acid
  B
  Banana 
  Bread
  Bank
  C
  Chart
  Character
  Court
   
   

Output: After executing this code, you will get the output, as shown below.

List Dividers

Inset Lists: By default, the list does not have an external margin. If you need a list to fill a set, you can add the inset property to the <ion-list> component.

Example: The below example shows how can you use inset with <ion-list-header> and <ion-list> component.

  
   
   
  Games 
  Pubg 
  Militia 
  Temple Run 
  Ludo
  Chess
    
   
   
  Games 
  Pubg 
  Militia 
  Temple Run 
  Ludo
  Chess 
   
    

Output: After executing this code, you will get the output, as shown below.

Inset Lists

Multi-line list: Multi-line lists are the same as regular lists, but that items contain multiple lines of text. When the <ion-item> component contains multiple headers or paragraph elements, its height will automatically expand to fit new lines of text.

Avatar List: Item avatars show a larger image than an icon, but smaller than a thumbnail. To use an avatar, add a <ion-avatar> element within an item. The avatar position can be set using the item-start and item-end property.

Example: The below example shows how you can use the avatar list in the ionic application.

  
   
   
  Avtar
   
   
   
   
    
   
  Avatar 
   
   
   
   
  Avatar 
  
   

Output: After executing this code, you will get the output, as shown below.

Multi-line list

Thumbnail List: Item thumbnails show an image that occupies the entire height of the item. To use a thumbnail, add a <ion- thumbnail> component within an element. Thumbnail position can be set using the item-start and item-end properties of the item.

Example: The below example shows how you can use the thumbnail list in the ionic application.

     
    
         
        Thumbnail
         
       
     
          
       
         
         Thumbnail  
           
             
               
             
           Thumbnail  
         
        

Output: After executing this code, you will get the output, as shown below.

Thumbnail List

Sliding List: Sliding elements can swipe left or right to reveal a set of hidden buttons. To use a sliding item, add a <ion-item-sliding> element inside of an <ion-list> element. Next, add a <ion-item-options> element within the slider to accommodate the buttons.

By default, the buttons are on the right side. It means when the sliding item is swiped from right to left, and the options are displayed. Set the side attribute to "start" on the < ion-item-options > element if you need to swipe the option from left to right side.

Example: This example shows how you can use the sliding list in the ionic application.

 
   
   
  Sliding List 
   
   
   
   
   
 
  
  
  Item 1
  
  
  Unread
  success
   
  
  
  
  Item 2
  
  
  Unread
  read
   
  
   

Output: After executing this code, you will get the output, as shown below.

Sliding List

When you swipe the item 1 from left to right, the following output shows in your browser.

When you swipe the item 1 from left to right

Related Topics

Ionic Cards

Ionic Cards: Ionic cards are a standard part of the user interface that acts as an entry point for more specific information. These are the best components for displaying information...

4 minutes read.

Features of Ionic Framework

The Ionic Framework is based on the AngularJS framework that permits a programmer to use a combination of many other programming languages, like HTML5, CSS, and JavaScript. Some of the...

4 minutes read.

Ionic Infinite Scroll

The infinite scroll permits you to perform an action when the user scrolls a particular content from the bottom or top of the page. When you display the large collection of data...

3 minutes read.

Ionic Colors

Ionic Colors Before we start with the actual elements available in the Ionic frame, let's understand a little bit how Ionic uses colors for different elements. Ionic Color Classes Ionic framework is a set of nine predefined...

3 minutes read.

History of Ionic

It is a complete open-source platform for hybrid mobile application development created by Ben Sperry, Max Lynch, and Adam Bradley of Drifty Co. in 2013. The first alpha version of the framework was...

2 minutes read.

Ionic Popover

The Ionic popover is a small dialog box that displays at the top of the screen. It can be used for anything, but it is usually used for a button, an action,...

4 minutes read.

Ionic Menu

The Ionic menu is the side-menu navigation that can be slide in from the side of the current view. By default, the menu slides in from the left side, but the side...

7 minutes read.

Ionic Spinner

The ionic spinner component provides the various SVG (Scalable Vector Graphic) spinners. Ionic spinners are the visual indicators that display the app which is loading content or performing another process that the user...

5 minutes read.

Ionic Range

The Range slider lets users choose from a range of values by moving the slider knob. You can accept two knobs, but by default, one-knob controls the range value. Range labels You can put down on...

2 minutes read.

Ionic Splash Screen

The Apache Cordova plugin helps to displays and hides a splash screen during the application launch. The Ionic Splash Screen is similar to a home page on a website. The ionic splash...

2 minutes read.

Ionic progress bar

The ionic progress bar element is a horizontal progress bar used to visualize the progression of operation and activity. You can use the <ion-progress-bar> component to create a progress bar in the ionic...

4 minutes read.

Ionic Refresher

Refresher means updating the currently showing page so that the user can see the latest view. It is also known as re-loading in web technology. It provides a pull- to-refresh feature on a...

4 minutes read.

Ionic Segment

A segment is a collection of buttons, sometimes which are known as segmented controls. The segment buttons are displayed at horizontal rows. These segment buttons can be shown in a toolbar or the...

2 minutes read.

Ionic vs Xamarin

Ionic vs Xamarin Ionic and Xamarin are both the most popular frameworks used to develop a hybrid mobile application. Both frameworks are used in large enterprises by the developers. Here, we will discuss the...

4 minutes read.

Ionic Modal

Ionic modal is displayed as a temporary UI that slides into the screen. The ionic modal is a dialog box that is displayed at the top of the app’s content, and it...

5 minutes read.

Ionic Radio

Ionic Radio The radio button is the type of input component that has a Boolean value. The Ionic radio button has a different pattern on every platform, as well as other Ionic components....

2 minutes read.

Ionic framework Installation

Installation of Ionic Before proceeding with the ionic application, you'll need to install node.js and NPM (Node Package Manager), the code editor, and Ionic CLI. Installation of node.js and NPM These are the primary...

5 minutes read.

Ionic Navigation and Routing

The latest version (ionic 4) of the ionic framework, no longer limited to the angular. In Ionic 4, you can create an ionic project in different front-end frameworks such as Vue.js, React.js, and...

6 minutes read.

Ionic Tabs

The ionic tabs mostly used for mobile navigation. It means that tabs are placed at the top of the display on android devices, while at the bottom on IOS. It does not provide...

2 minutes read.

Ionic Checkbox

Ionic Checkbox Ionic Checkbox is nearly the same as a toggle. It can be placed in an ionic element or used as a separate checkbox. It is designed differently for every platform, such...

2 minutes read.