Skip to main content

Components

Chips

Chips allow users to enter information, make selections, filter content, or trigger actions.

banner-Chips

Chips allow users to enter information, make selections, filter content, or trigger actions.

While buttons are expected to appear consistently and with familiar calls to action, chips should appear dynamically as a group of multiple interactive elements.

chips usage

Usage

Use this tag LgnPrimary{Size}ChipContainerto implement Legion Chips.

Variants

Size

Legion have two size variants of chips.

1. Small Variants

The following is usage to implement Small Size variants

Static in Xml

<com.telkom.legion.component.chips.small.LgnPrimarySmallChipContainer
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Stacked Chip Filter Type"
app:chipType="FILTER_TYPE" />

Dynamic using Kotlin

...
with(binding) {
containerBase.addView( //ViewGroup for Dynamic Layout
LgnPrimarySmallChipContainer(requiredContext()).apply {
//Your View's customization here
},
LinearLayout.LayoutParams( //For example we use viewgroup LinearLayout
LinearLayout.LayoutParams.MATCH_PARENT,
LinearLayout.LayoutParams.WRAP_CONTENT

2. Large variants

The following is usage to implement Large Size variants

Static in Xml

<com.telkom.legion.component.chips.large.LgnPrimaryLargeChipContainer
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Stacked Chip Filter Type"
app:chipType="FILTER_TYPE" />

Dynamic using Kotlin

...
with(binding) {
containerBase.addView( //ViewGroup for Dynamic Layout
LgnPrimaryLargeChipContainer(requiredContext()).apply {
//Your View's customization here
},
LinearLayout.LayoutParams( //For example we use viewgroup LinearLayout
LinearLayout.LayoutParams.MATCH_PARENT,
LinearLayout.LayoutParams.WRAP_CONTENT


Style

Legion have two style variants of chips.

1. Default Type

To implement Default style , you can customize from the properties. app:chipType="DEFAULT_TYPE"

Static in Xml

<com.telkom.legion.component.chips.small.LgnPrimarySmallChipContainer
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Stacked Chip Filter Type"
app:chipType="DEFAULT_TYPE" />

Dynamic using Kotlin

...
with(binding) {
containerBase.addView( //ViewGroup for Dynamic Layout
LgnPrimarySmallChipContainer(requiredContext()).apply {
chipType = ChipsType.DEFAULT_TYPE
//Your View's customization here
},
LinearLayout.LayoutParams( //For example we use viewgroup LinearLayout
LinearLayout.LayoutParams.MATCH_PARENT,


2. Filter Type

To implement Filter style , you can customize from the properties. app:chipType="FILTER_TYPE"

Static in Xml

<com.telkom.legion.component.chips.small.LgnPrimarySmallChipContainer
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Stacked Chip Filter Type"
app:chipType="FILTER_TYPE" />

Dynamic using Kotlin

...
with(binding) {
containerBase.addView( //ViewGroup for Dynamic Layout
LgnPrimarySmallChipContainer(requiredContext()).apply {
chipType = ChipsType.FILTER_TYPE
//Your View's customization here
},
LinearLayout.LayoutParams( //For example we use viewgroup LinearLayout
LinearLayout.LayoutParams.MATCH_PARENT,

Attributes

Attribute NameXml AttrsRelated method(s)Description
TextN/AtextTo get or set selection value on Filter Type directly
Hintandroid:hinthintTo set label value directly via xml
Enable Status [WIP]N/AN/ATo set enable or disable chips directly via xml
Required Statusapp:isRequiredisRequiredTo set required status on text area directly via xml
Optional Statusapp:isOptionalisOptionalTo set optional status on text area directly via xml
Helper textapp:helperTexthelperTo set helper text directly via xml
Chip Typeapp:chipTypechipTypeTo set chip type directly via xml
Single Lineapp:isSingleLineisSingleLineTo set chips single line directly via xml
Show Close Iconapp:closeIconVisiblecloseIconVisibleTo set show close icon on chips directly via xml
Single Selection [BETA]app:isSingleSelectionisSingleSelectionTo set chips single selection directly via xml
Background Color [BETA]app:chipBackgroundColorchipBackgroundColorTo set chips background color directly via xml
Stroke Color [BETA]app:chipStrokeColorchipStrokeColorTo set chips stroke color directly via xml
Text Color [BETA]android:textColortextColorsTo set chips text color directly via xml
Add ChipsN/AaddAll(List<String>)To add chips programaticaly
Add ListenerN/AsetListener { text -> }To add listener on chips programaticaly
Add Close ListenerN/AsetOnCloseIconClickListener { text -> }To add close listener on chips programaticaly