Skip to main content
Give us your valuable feedback

It will help us understand how we can serve you better

Give feedback

Components

Navigation Bar

A responsive navigation header positioned on top side of your page that includes support for branding, links, navigation, collapse and more.

banner-Navigation Bar
Square Icon

Selected Theme

Select brand or tribe name to preview style

Others
Component Status Details

Status component contains a list of checks and completeness that has been tested and owned by each component

check-list-icon We don't use color as the only visual tool to convey information.
check-list-icon The component’s structure and properties include relevant options such as variant, style, size, orientation, optional iconography, decorations, selection, error state, etc.check-list-icon The title is the component name that uses the frame base component template.check-list-icon The base component name contains: .Base & "Component Name" if there is more than one.check-list-icon All component properties use the Legion foundation.
check-list-icon We can change all the parts that are connected to the component base.check-list-icon The inside of the base component remains connected to the master component.check-list-icon All variant options are not damaged when we change from one to another.check-list-icon Overriding changes to components will not reset other variants.
check-list-icon Component's already has component specs documentation.

Status

Resources

Upcoming Upcoming

Navigation Bar or NavBar is an embedded name to define a navigation system that is collected in one section on the Android display. The shape, which is generally long in shape with a title, makes designers call it a bar (beam).

spinner android

Variants

Legion has 6 variants for NavBar :

  1. Navbar Title
  2. Navbar Title and Description
  3. Navbar Title Large
  4. Navbar Title and Description Large
  5. Navbar Search Bar
  6. Navbar Search Bar with Title

Usage

To implement NavBar , you can define in xml or you can set the attribute programmatically.

1. Navbar Title

Static in xml

<com.telkom.legion.component.navbar.LgnTitleNavBar
...
app:title="@string/label_navbar_sample_title"
app:menu="@menu/navbar_menu"/>

Dynamic using Kotlin*

...
binding.navbarTitle.apply {
title = "Title"
menu = R.menu.navbar_menu
}
...

Set event listener

...
binding.navbarTitle.apply {
setOnMenuItemClickListener(listener)
setOnNavigationClickListener(listener)
}
...

2. Navbar Title and Description

Static in xml

<com.telkom.legion.component.navbar.LgnTitleDescNavBar
...
app:title="@string/label_navbar_sample_title"
app:description="@string/label_navbar_sample_description"
app:menu="@menu/navbar_menu"/>

Dynamic using Kotlin*

...
binding.navbarTitleDesc.apply {
title = "Title"
description = "Description"
menu = R.menu.navbar_menu
}
...

Set event listener

...
binding.navbarTitleDesc.apply {
setOnMenuItemClickListener(listener)
setOnNavigationClickListener(listener)
}
...

3. Navbar Title Large

Static in xml

<com.telkom.legion.component.navbar.LgnTitleLargeNavBar
...
app:title="@string/label_navbar_sample_title"
app:menu="@menu/navbar_menu"/>

Dynamic using Kotlin*

...
binding.navbarTitleLarge.apply {
title = "Title"
menu = R.menu.navbar_menu
}
...

Set event listener

...
binding.navbarTitleLarge.apply {
setOnMenuItemClickListener(listener)
setOnNavigationClickListener(listener)
}
...

4. Navbar Title and Description Large

Static in xml

<com.telkom.legion.component.navbar.LgnTitleDescLargeNavBar
...
app:title="@string/label_navbar_sample_title"
app:description="@string/label_navbar_sample_description"
app:menu="@menu/navbar_menu"/>

Dynamic using Kotlin*

...
binding.navbarTitleDescLarge.apply {
title = "Title"
description = "Description"
menu = R.menu.navbar_menu
}
...

Set event listener

...
binding.navbarTitleDescLarge.apply {
setOnMenuItemClickListener(listener)
setOnNavigationClickListener(listener)
}
...

Static in xml

<com.telkom.legion.component.navbar.LgnSearchNavBar
...
app:placeholder="@string/label_navbar_sample_placeholder"
app:menu="@menu/navbar_menu"
app:startIconDrawable="@drawable/ic_clock"
app:endIconDrawable="@drawable/ic_eye_on"/>

Dynamic using Kotlin*

...
binding.navbarSearchBar.apply {
placeholder = "Placeholder"
startIconDrawable = ContextCompat.getDrawable(context, R.drawable.startIcon)
endIconDrawable = ContextCompat.getDrawable(context, R.drawable.endIcon)
imeOptions = EditorInfo.IME_ACTION_SEARCH
menu = R.menu.navbar_menu
}

Set event listener

...
binding.navbarSearchBar.apply {
setOnMenuItemClickListener(listener)
setOnNavigationClickListener(listener)
setOnStartIconTextFieldListener(listener)
setOnEndIconTextFieldListener(listener)
}

6. Navbar Search Bar with Title

Static in xml

<com.telkom.legion.component.navbar.LgnTitleSearchNavBar
...
app:title="@string/label_navbar_sample_title"
app:placeholder="@string/label_navbar_sample_placeholder"
app:menu="@menu/navbar_menu"
app:startIconDrawable="@drawable/ic_clock"
app:endIconDrawable="@drawable/ic_eye_on"/>

Dynamic using Kotlin*

...
binding.navbarSearchBarTitle.apply {
title = "Title"
placeholder = "Placeholder"
startIconDrawable = ContextCompat.getDrawable(context, R.drawable.startIcon)
endIconDrawable = ContextCompat.getDrawable(context, R.drawable.endIcon)
imeOptions = EditorInfo.IME_ACTION_SEARCH
menu = R.menu.navbar_menu
}

Set event listener

...
binding.navbarSearchBarTitle.apply {
setOnMenuItemClickListener(listener)
setOnNavigationClickListener(listener)
setOnStartIconTextFieldListener(listener)
setOnEndIconTextFieldListener(listener)
}
...

Attribute

Attribute NameXml AttrsRelated method(s)Description
Titleapp:titletitleTo set and get title
Descriptionapp:descriptiondescriptionTo set and get description
Menu Toolbarapp:menumenuTo set menu action in toolbar. need to define menu xml
Placeholderapp:placeholderplaceholderTo set placeholder in edit text
Start Icon Drawableapp:startIconDrawablestartIconDrawableTo set prefix icon in edit text
End Icon Drawableapp:endIconDrawableendIconDrawableTo set suffix icon in edit text
Ime Optionsandroid:imeOptionsimeOptionsTo set ime options in edit text
Edit Text ValueN/AetValueTo set edittext value in edit text
Event Back NavigationN/AsetOnNavigationClickListenerTo set event back click listener
Event Menu NavigationN/AsetOnEndIconTextFieldListenerTo set event menu item click listener
Event Start Icon Edit TextN/AsetOnEndIconTextFieldListenerTo set event start icon on edit text click listener
Event End Icon Edit TextN/AsetOnEndIconTextFieldListenerTo set event end icon on edit text click listener
Event Text Changed Edit TextN/AsetOnEditTextChangeListenerTo set edit text changed on text listener