Open In App

Onsen UI Tabbar CSS Components

Improve
Improve
Like Article
Like
Save
Share
Report

Onsen UI CSS is used to create beautiful HTML components. It is one of the most efficient ways to create HTML5 hybrid components that are compatible with both mobile and desktop.

Tabbar is used to create the Tabs using Onsen UI classes. In this article, we will discuss how to create Tabbar component in Onsen UI.

Onsen UI Tabbar CSS Components:

Syntax:

<div class="tabbar ....">
      ...
</div>

Example 1: In this example, we will use the Onsen UI CSS Component Icon Tabbar for creating the User Interface.

HTML




<!DOCTYPE html>
<html>
  
<head>
    <link rel="stylesheet" href=
    <link rel="stylesheet" href=
    <link href=
        rel="stylesheet">
</head>
  
<body>
    <div style="margin:2rem;
                font-family:Roboto, sans-serif;">
        <h1 style="color:green;">GeeksforGeeks</h1>
        <h3 style="margin-top:-1.5rem;">
            Onsen UI CSS Component Icon Tabbar
        </h3>
        <br/>
    </div>
    <div class="tabbar">
        <label class="tabbar__item">
            <input type="radio"
                name="tabbar-a"
                checked="checked">
            <button class="tabbar__button">
                <i class="tabbar__icon ion-ios-home"></i>
                <div class="tabbar__label">
                Home
                </div>
            </button>
        </label>
  
        <label class="tabbar__item">
            <input type="radio" name="tabbar-a">
            <button class="tabbar__button">
                <i class="tabbar__icon ion-ios-search"></i>
                <div class="tabbar__label">
                Search
                </div>
            </button>
        </label>
  
        <label class="tabbar__item">
            <input type="radio" name="tabbar-a">
            <button class="tabbar__button">
                <i class="tabbar__icon ion-ios-person"></i>
                <div class="tabbar__label">
                Profile
                </div>
            </button>
        </label>
    </div>
</body>
</html>


Output:

 

Example 2: The following example demonstrates the Onsen UI CSS Component Basic Tabbar.

HTML




<!DOCTYPE html>
<html>
  
<head>
    <!-- CDN links of Onsen UI library -->
    <link rel="stylesheet" href=
    <link rel="stylesheet" href=
    <script src=
    </script>
</head>
  
<body>
    <center>
        <h1 style="color: green;">
            GeeksforGeeks
        </h1>
        <h3>
            Onsen UI CSS Component Basic Tabbar
        </h3>
        <div class="tabbar">
            <label class="tabbar__item">
                <input type="radio"
                    name="tabs"
                    checked="checked">
                <button class="tabbar__button">
                    <div class="tabbar__label">
                        Item 1
                    </div>
                </button>
            </label>
          
            <label class="tabbar__item">
                <input type="radio"
                    name="tabs">
                <button class="tabbar__button">
                    <div class="tabbar__label">
                        Item 2
                    </div>
                </button>
            </label>
          
            <label class="tabbar__item">
                <input type="radio"
                    name="tabs">
                <button class="tabbar__button">
                    <div class="tabbar__label">
                        Item 3
                    </div>
                </button>
            </label>
        </div>
    </center>
</body>
</html>


Output:

 

Example 3: This code below demonstrates the Icon-only tab bar.

HTML




<!DOCTYPE html>
<html>
  
<head>
    <link rel="stylesheet" href=
    <link rel="stylesheet" href=
    <link href=
        rel="stylesheet">
</head>
  
<body>
    <div style="margin: 2rem; font-family: Roboto, sans-serif;">
        <h1 style="color: green;">GeeksforGeeks</h1>
        <h3 style="margin-top: -1.5rem;">
        Onsen UI CSS Component Icon Only Tabbar
        </h3>
        <br />
    </div>
    <div class="tabbar">
        <label class="tabbar__item">
            <input type="radio" name="tabbar-a"
                checked="checked">
            <button class="tabbar__button">
                <i class="tabbar__icon ion-ios-home"></i>
            </button>
        </label>
  
        <label class="tabbar__item">
            <input type="radio" name="tabbar-a">
            <button class="tabbar__button">
                <i class="tabbar__icon ion-ios-search"></i>
            </button>
        </label>
  
        <label class="tabbar__item">
            <input type="radio" name="tabbar-a">
            <button class="tabbar__button">
                <i class="tabbar__icon ion-ios-person"></i>
            </button>
        </label>
    </div>
</body>
  
</html>


Output:

 

Example 4: The following example demonstrates the Onsen UI CSS Component Top Tabbar.

HTML




<!DOCTYPE html>
<html>
  
<head>
    <!-- CDN links of Onsen UI library -->
    <link rel="stylesheet" href=
    <link rel="stylesheet" href=
    <script src=
    </script>
</head>
  
<body>
    <center>
        <h2 style="color: green;">
            GeeksforGeeks
        </h2>
        <strong>
            Onsen UI CSS Component Top Tabbar
        </strong> <br> <br>
  
        <div class="tabbar tabbar--top">
            <label class="tabbar__item">
                <input type="radio" name="tabs"
                    checked="checked">
                <button class="tabbar__button">
                    <div class="tabbar__label">
                        Item 1
                    </div>
                </button>
            </label>
          
            <label class="tabbar__item">
                <input type="radio" name="tabs">
                <button class="tabbar__button">
                    <div class="tabbar__label">
                        Item 2
                    </div>
                </button>
            </label>
          
            <label class="tabbar__item">
                <input type="radio" name="tabs">
                <button class="tabbar__button">
                    <div class="tabbar__label">
                        Item 3
                    </div>
                </button>
            </label>
        </div>
    </center>
</body>
  
</html>


Output:

 

Example 5: The following example demonstrates the Onsen UI CSS Component Bordered Top Tabbar.

HTML




<!DOCTYPE html>
<html>
  
<head>
    <!-- CDN links of Onsen UI library -->
    <link rel="stylesheet" href=
    <link rel="stylesheet" href=
    <script src=
    </script>
</head>
  
<body>
    <center>
        <h2 style="color: green;">
            GeeksforGeeks
        </h2>
        <strong>
            Onsen UI CSS Component Bordered Top Tabbar
        </strong> <br> <br>
  
        <div class="tabbar tabbar--top
                    tabbar--top-border">
            <label class="tabbar__item
                            tabbar--top-border__item">
                <input type="radio" name="tabs"
                    checked="checked">
                <button class="tabbar__button
                        tabbar--top-border__button">
                    Item 1
                </button>
            </label>
          
            <label class="tabbar__item
                        tabbar--top-border__item">
                <input type="radio" name="tabs"
                    checked="checked">
                <button class="tabbar__button
                        tabbar--top-border__button">
                    Item 2
                </button>
            </label>
          
            <label class="tabbar__item
                        tabbar--top-border__item">
                <input type="radio" name="tabs"
                    checked="checked">
                <button class="tabbar__button
                        tabbar--top-border__button">
                    Item 3
                </button>
            </label>
          
            <label class="tabbar__item
                        tabbar--top-border__item">
                <input type="radio" name="tabs"
                    checked="checked">
                <button class="tabbar__button
                        tabbar--top-border__button">
                    Item 4
                </button>
            </label>
        </div>
    </center>
</body>
  
</html>


Output:

 

Example 6: The following example demonstrates the Onsen UI CSS Component Material Tabbar.

HTML




<!DOCTYPE html>
<html>
  
<head>
    <!-- CDN links of Onsen UI library -->
    <link rel="stylesheet" href=
    <link rel="stylesheet" href=
    <script src=
    </script>
</head>
  
<body>
    <center>
        <h2 style="color: green;">
            GeeksforGeeks
        </h2>
        <strong>
            Onsen UI CSS Component Material Tabbar
        </strong> <br> <br>
  
        <div class="tabbar tabbar--top
                    tabbar--material">
            <label class="tabbar__item
                        tabbar--material__item">
                <input type="radio" name="tabs"
                    checked="checked">
                <button class="tabbar__button
                        tabbar--material__button">
                    Item 1
                </button>
            </label>
          
            <label class="tabbar__item
                        tabbar--material__item">
                <input type="radio" name="tabs"
                    checked="checked">
                <button class="tabbar__button
                        tabbar--material__button">
                    Item 2
                </button>
            </label>
          
            <label class="tabbar__item
                        tabbar--material__item">
                <input type="radio" name="tabs"
                    checked="checked">
                <button class="tabbar__button
                        tabbar--material__button">
                    Item 3
                </button>
            </label>
        </div>
    </center>
</body>
  
</html>


Output:

 

Reference: https://onsen.io/v2/api/css.html#tabbar-category



Last Updated : 02 Sep, 2022
Like Article
Save Article
Previous
Next
Share your thoughts in the comments