android-components / mozilla.components.browser.toolbar / BrowserToolbar / TwoStateButton

# TwoStateButton

`class TwoStateButton : Button` (source)

An action that either shows an active button or an inactive button based on the provided isEnabled lambda.

### Parameters

`enabledImage` - The drawable to be show if the button is in the enabled stated.

`enabledContentDescription` - The content description to use if the button is in the enabled state.

`disabledImage` - The drawable to be show if the button is in the disabled stated.

`disabledContentDescription` - The content description to use if the button is in the enabled state.

`isEnabled` - Lambda that returns true of false to indicate whether this button should be enabled/disabled.

`background` - A custom (stateful) background drawable resource to be used.

`listener` - Callback that will be invoked whenever the checked state changes.

### Constructors

<init> | `TwoStateButton(enabledImage: Drawable, enabledContentDescription: String, disabledImage: Drawable, disabledContentDescription: String, isEnabled: () -> Boolean = { true }, background: Int = 0, listener: () -> Unit)` An action that either shows an active button or an inactive button based on the provided isEnabled lambda.

### Properties

enabled | `var enabled: Boolean`

### Inherited Properties

padding | `val padding: Padding` a custom Padding for this Button.

### Functions

bind | `open fun bind(view: View): Unit`