Button

Interactive element used for single-step actions

Import

View-based framework

Before you can use components from the Backbase Design System SDK, make sure you've installed the package.

Kotlin

If you need to reference the BackbaseButton component in your Kotlin code, import it at the top of your file.


                                                        
                                                        
                                                            import com.backbase.android.design.button.BackbaseButton
                                                        
                                                            

 

XML

Components work automatically in XML files if the component path matches the installed package.


                                                        
                                                        
                                                            <com.backbase.android.design.button.BackbaseButton
                                                        	android:layout_width="match_parent"
                                                        	android:layout_height="wrap_content"
                                                        	... />
                                                        
                                                            

 

Usage

Basic usage

Use BackbaseButton with predefined styles in XML layouts. The component extends MaterialButton providing full access to the MaterialButton API.

Button | Basic usage

                                                        
                                                        
                                                            <!-- Basic button with primary style -->
                                                        <com.backbase.android.design.button.BackbaseButton
                                                        	style="?buttonStylePrimary"
                                                        	android:layout_width="wrap_content"
                                                        	android:layout_height="wrap_content"
                                                        	android:text="Button" />
                                                        
                                                            

 

Advanced usage

Button | Advanced usage

                                                        
                                                        
                                                            <!-- Button with icon and custom configuration -->
                                                        <com.backbase.android.design.button.BackbaseButton
                                                        	style="?buttonStyleSuccess"
                                                        	android:layout_width="match_parent"
                                                        	android:layout_height="wrap_content"
                                                        	android:text="Submit"
                                                        	app:icon="?iconAdd"
                                                        	android:enabled="true" />
                                                        
                                                            

 

Configuration

Property

Type

Default

android:enabled

Button interactivity state

Boolean

true

android:text

Button text content

String

""

app:icon

Leading icon drawable

Drawable

null

loading

Loading state with progress indicator

Boolean

false

style

Predefined button style

Style Resource

?buttonStylePrimary

 

android:enabled

The android:enabled attribute controls button interactivity and applies disabled styling.


                                                        
                                                        
                                                            <!-- Disabled button -->
                                                        <com.backbase.android.design.button.BackbaseButton
                                                        	android:enabled="false"
                                                        	android:text="Disabled Button" />
                                                        
                                                            

 

android:text

The android:text attribute sets the button's text content.


                                                        
                                                        
                                                            <!-- Button with custom text -->
                                                        <com.backbase.android.design.button.BackbaseButton
                                                        	android:text="Custom Text" />
                                                        
                                                            

 

app:icon

The app:icon attribute adds a leading icon using design system icon tokens.


                                                        
                                                        
                                                            <!-- Button with icon -->
                                                        <com.backbase.android.design.button.BackbaseButton
                                                        	android:text="With Icon"
                                                        	app:icon="?iconAdd" />
                                                        
                                                            

 

loading

The loading property displays a circular progress indicator and disables user interaction.

Button | Loading

                                                        
                                                        
                                                            // Control loading state in Kotlin
                                                        val button: BackbaseButton = findViewById(R.id.button)
                                                        button.loading = true
                                                        // Stop loading
                                                        button.loading = false
                                                        
                                                            

 

Styling

Predefined styles

The BackbaseButton provides several predefined styles using the style attribute. Always use predefined styles without custom modifications to ensure consistency.

Description

API

Primary button

Primary button

?buttonStylePrimary

Secondary button

Secondary button

?buttonStyleSecondary

Tertiary button

Tertiary button

?buttonStyleTertiary

Success / confirmation button

Success / confirmation button

?buttonStyleSuccess

Destructive action button

Destructive action button

?buttonStyleDanger

 

Small Button variants

Use small button styles for compact layouts.

Description

API

Small primary button

Small primary button

?buttonStyleSmallPrimary

Small secondary button

Small secondary button

?buttonStyleSmallSecondary

Small tertiary button

Small tertiary button

?buttonStyleSmallTertiary

Small success button

Small success button

?buttonStyleSmallSuccess

Small danger button

Small danger button

?buttonStyleSmallDanger

 

On color variants

Use the buttonOnColorThemeOverlay on parent layouts for buttons on dark backgrounds.

Button | On-color primary
Button | On-color secondary
Button | On-color tertiary

                                                        
                                                        
                                                            <!-- Button on colored background -->
                                                        <LinearLayout
                                                        	android:layout_width="match_parent"
                                                        	android:layout_height="wrap_content"
                                                        	android:background="?colorBackgroundBrand"
                                                        	android:theme="?buttonOnColorThemeOverlay">
                                                        	
                                                        	<com.backbase.android.design.button.BackbaseButton
                                                        		style="?buttonStylePrimary"
                                                        		android:text="On Color Button" />
                                                        </LinearLayout>
                                                        
                                                            

 

States

Loading

Display loading state using the loading property in Kotlin code.

Button | Loading

                                                        
                                                        
                                                            // Start loading state
                                                        val button: BackbaseButton = findViewById(R.id.submit_button)
                                                        button.loading = true
                                                        // Stop loading state
                                                        button.loading = false
                                                        
                                                            

 

Disabled

Control button state using the enabled property or XML attribute.

Button | Disabled

                                                        
                                                        
                                                            // Disable button in code
                                                        button.isEnabled = false
                                                        // Enable button
                                                        button.isEnabled = true
                                                        
                                                            

                                                        
                                                        
                                                            <!-- Disabled button in XML -->
                                                        <com.backbase.android.design.button.BackbaseButton
                                                        	android:enabled="false"
                                                        	android:text="Disabled" />
                                                        
                                                            

 

Events

Button uses standard Android click listeners for handling user interactions.


                                                        
                                                        
                                                            // Set click listener
                                                        val button: BackbaseButton = findViewById(R.id.button)
                                                        button.setOnClickListener {
                                                        	// Handle button click
                                                        	Toast.makeText(this, "Button clicked!", Toast.LENGTH_SHORT).show()
                                                        }
                                                        
                                                            

 

Accessibility

Best practices

  • Button automatically provides appropriate accessibility traits
  • Loading state is communicated through state descriptions
  • Disabled state is properly conveyed to accessibility services

                                                        
                                                        
                                                            // Configure accessibility
                                                        button.contentDescription = "Submit form button"
                                                        
                                                            

 

Design tokens

The BackbaseButton uses comprehensive design tokens for theming all button variants through the global theme.

 

Token Groups used by BackbaseButton:

  • color/button/primary: Background, foreground, and border colors for primary buttons
  • color/button/secondary: Background, foreground, and border colors for secondary buttons
  • color/button/tertiary: Background, foreground, and border colors for tertiary buttons
  • color/button/success: Background, foreground, and border colors for success buttons
  • color/button/danger: Background, foreground, and border colors for danger buttons
  • color/button/disabled: Colors for disabled state
  • color/button/on-color-*: Colors for buttons on colored backgrounds
color / button / on-color-secondary / default
rgba(0,0,0,0)
background
#ffffff
foreground
#ffffff
border
color / button / on-color-secondary / hovered
rgba(255,255,255,0.72)
background
#000000
foreground
#ffffff
border
color / button / on-color-secondary / pressed
rgba(255,255,255,0.56)
background
#000000
foreground
#ffffff
border
color / button / on-color-primary / default
#ffffff
background
#000000
foreground
rgba(0,0,0,0)
border
color / button / on-color-primary / hovered
rgba(255,255,255,0.72)
background
#000000
foreground
rgba(0,0,0,0)
border
color / button / on-color-primary / pressed
rgba(255,255,255,0.56)
background
#000000
foreground
rgba(0,0,0,0)
border
color / button / primary / pressed
#152f80
background
#ffffff
foreground
rgba(0,0,0,0)
border
color / button / primary / default
#295eff
background
#ffffff
foreground
rgba(0,0,0,0)
border
color / button / primary / hovered
#2049c6
background
#ffffff
foreground
rgba(0,0,0,0)
border
color / button / danger / pressed
#691309
background
#ffffff
foreground
rgba(0,0,0,0)
border
color / button / danger / hovered
#86190b
background
#ffffff
foreground
rgba(0,0,0,0)
border
color / button / danger / default
#bf2310
background
#ffffff
foreground
rgba(0,0,0,0)
border
color / button / secondary / default
rgba(0,0,0,0)
background
#295eff
foreground
#295eff
border
color / button / secondary / pressed
#dee2ff
background
#152f80
foreground
#152f80
border
color / button / secondary / hovered
#dee2ff
background
#152f80
foreground
#152f80
border
color / button / disabled / default
#ccd5df
background
#7189a7
foreground
rgba(0,0,0,0)
border
color / button / on-color-tertiary / default
rgba(0,0,0,0)
background
#ffffff
foreground
rgba(0,0,0,0)
border
color / button / on-color-tertiary / hovered
rgba(255,255,255,0.72)
background
#000000
foreground
rgba(0,0,0,0)
border
color / button / on-color-tertiary / pressed
rgba(255,255,255,0.56)
background
#000000
foreground
rgba(0,0,0,0)
border
color / button / tertiary / default
rgba(0,0,0,0)
background
#295eff
foreground
rgba(0,0,0,0)
border
color / button / tertiary / hovered
#dee2ff
background
#152f80
foreground
rgba(0,0,0,0)
border
color / button / tertiary / pressed
#dee2ff
background
#152f80
foreground
rgba(0,0,0,0)
border
color / button / success / default
#0e813e
background
#ffffff
foreground
rgba(0,0,0,0)
border
color / button / success / hovered
#0a5a2b
background
#ffffff
foreground
rgba(0,0,0,0)
border
color / button / success / pressed
#084722
background
#ffffff
foreground
rgba(0,0,0,0)
border
color / button / on-color-disabled / default
rgba(255,255,255,0.36)
background
rgba(255,255,255,0.72)
foreground
rgba(0,0,0,0)
border
color / button / dark / pressed
#ccd5df
background
#061223
foreground
rgba(0,0,0,0)
border
color / button / dark / default
rgba(0,0,0,0)
background
#061223
foreground
rgba(0,0,0,0)
border
color / button / dark / hovered
#e1e8ef
background
#061223
foreground
rgba(0,0,0,0)
border
color / button / neutral / hovered
#e1e8ef
background
#061223
foreground
#ccd5df
border
color / button / neutral / pressed
#ccd5df
background
#061223
foreground
#ccd5df
border
color / button / neutral / default
#ffffff
background
#061223
foreground
#ccd5df
border