Components
Button
Used to initiate an action or trigger the users
Buttons are used to initiate an action or trigger the user to open a link. Buttons can contain a combination of clear and concise labels and can be equipped with icons.
Usage
To implement Button, you can use this tag “Lgn{Theme}{Variant}Button”
Variant
You can customise the appearance of the button via the variant prop, which accepts either fill, outline, ghost.
Fill Button
The following is the format for using Fill Button “Lgn{Theme}{Variant}Button”
<com.telkom.legion.component.button.fill.LgnPrimaryLargeButtonandroid:id="@+id/btnLargePrimary"android:layout_width="wrap_content"android:layout_height="wrap_content"android:layout_marginStart="@dimen/dimen_16dp"android:layout_marginTop="20dp"android:text="Large Button" />
Outline Button
The following is the format for using Fill Button “Lgn{Theme}{Variant}Button”
<com.telkom.legion.component.button.outline.LgnPrimaryOutlineLargeButtonandroid:id="@+id/btnOutlineLargePrimary"android:layout_width="wrap_content"android:layout_height="wrap_content"android:layout_marginStart="@dimen/dimen_16dp"android:layout_marginTop="@dimen/dimen_20dp"android:layout_marginEnd="@dimen/dimen_16dp"android:text="Large Button"app:startIconDrawable="@drawable/ic_search"
Ghost Button
The following is the format for using Fill Button “Lgn{Theme}{Variant}Button”
<com.telkom.legion.component.button.ghost.LgnPrimaryGhostFitButtonandroid:id="@+id/btnFitGhostPrimary"android:layout_width="match_parent"android:layout_height="wrap_content"android:layout_marginHorizontal="16dp"android:layout_marginTop="20dp"android:text="Fit Button"app:endIconDrawable="@drawable/ic_calendar"app:startIconDrawable="@drawable/ic_search" />
Transparent Button
The following is the format for using Fill Button “Lgn{Theme}{Variant}Button”
<com.telkom.legion.component.button.ghost.LgnPrimaryGhostFitButtonandroid:id="@+id/btnFitGhostPrimary"android:layout_width="match_parent"android:layout_height="wrap_content"android:layout_marginHorizontal="16dp"android:layout_marginTop="20dp"android:text="Fit Button"app:endIconDrawable="@drawable/ic_calendar"app:startIconDrawable="@drawable/ic_search" />
Theming buttons
Legion support customization button and can be customized can be customized according to user needs.
Color Themes
| Color Themes | View |
|---|---|
| Primary | ![]() |
| Secondary | ![]() |
| Error | ![]() |
Properties
| Component Name | Id | Description |
|---|---|---|
| TextView | tvText | To display label on Button |
| Progress Bar | pbButton | To progress indicator on Button |
| ImageView | ivStartIconDrawable | To display icon on front Button |
| ImageView | ivEndIconDrawable | To display icon on behind Button |
Attributes
| Attribute Name | Xml Attrs | Related method(s) | Description |
|---|---|---|---|
| Text | android:text | text | To set Text value directly via xml |
| Enable Status | android:enabled | isEnable | To set enable or disable button directly via xml |
| Loading Status | app:isLoading | isLoading | To set loading status button directly via xml |
| Icon on Front Text | app:startIconDrawable | startIconDrawable | To set icon on front button directly via xml |
| Icon on Behind Text | app:endIconDrawable | endIconDrawable | To set icon on behind button directly via xml |
Example
Static in Xml
<com.telkom.legion.component.button.fill.LgnPrimaryLargeButtonandroid:id="@+id/btnLargePrimary"android:layout_width="wrap_content"android:layout_height="wrap_content"android:layout_marginStart="@dimen/dimen_16dp"android:layout_marginTop="20dp"android:text="Large Button" />
Dynamic using Kotlin
...with(binding) {containerBase.addView( //ViewGroup for Dynamic LayoutLgnPrimaryLargeButton(requiredContext()).apply {//Your View's customization here},LinearLayout.LayoutParams( //For example we use viewgroup LinearLayoutLinearLayout.LayoutParams.MATCH_PARENT,LinearLayout.LayoutParams.WRAP_CONTENT
Add Click Listener
btnLargePrimary.setOnClickListener {//Your Action on Listener}
Do you have feedback?
Please let us know to make it better


