Skip to main content

Components

Textarea

Used to enter long text input which spans over multiple lines

banner-Textarea

Usage

Textarea allow user input. The border should light up simply and clearly indicating which field the user is currently editing.

Basic

Here’s the default usage of Textarea with placeholder and label attribute set.

basic textarea

Static in xml

<com.telkom.legion.component.textfield.LgnTextAreaField
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Catatan"
app:placeholderText="Tambahkan Catatan" />

Dynamic using Kotlin*

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

Required Text Area

Add required status to make it easier for users to know which fields are required status, the label will automatically be added with a red asterisk mark

required text area

Static in xml

<com.telkom.legion.component.textfield.LgnTextAreaField
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Catatan"
app:isRequired="true"
app:placeholderText="Tambahkan Catatan" />

Dynamic using Kotlin*

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

Optional Text Area

Add optional status to make it easier for users to know which fields are optional, labels will be automatically added text (Optional) in various languages

optional textarea

Static in xml

<com.telkom.legion.component.textfield.LgnTextAreaField
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Catatan"
app:isOptional="true"
app:placeholderText="Tambahkan Catatan" />

Dynamic using Kotlin*

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

Disabled Text Area

Make textarea look inactive.

disabled textarea

Static in xml

<com.telkom.legion.component.textfield.LgnTextAreaField
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Catatan"
android:enabled="false"
app:placeholderText="Tambahkan Catatan" />

Dynamic using Kotlin*

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

Error Indicator Text Area

Add an error indicator to make it easier for users to find out which fields are wrong in inputting, and provide error messages in the relevant fields

error indicator textarea

Static in xml

<com.telkom.legion.component.textfield.LgnTextAreaField
android:id="@+id/etAreaError"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Catatan"
app:placeholderText="Tambahkan Catatan" />

In Your Kotlin Code

...
with(binding) {
etAreaError.error = "Your error message"
}
...

Dynamic using Kotlin*

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

Properties

Component NameIdDescription
TextViewtvHintTo display label on text area
TextInputLayoutetBaseTo display text field on text area
TextViewtvHelperTo display helper text on text area
TextViewtvErrorTo display error text on text area

Attributes

Attribute NameXml AttrsRelated method(s)Description
Textandroid:texttextTo set Text value directly via xml
Hintandroid:hinttextTo set Hint or Label value directly via xml
Enable Statusandroid:enabledisEnableTo set enable or disable text area 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
Placeholder textapp:placeholderTextplaceHolderTo set placeholder text directly via xml
Helper textapp:placeholderTexthelperTo set helper text directly via xml