# Titanium.UI.Android.Snackbar

> Snackbars provide brief messages about app processes at the bottom of the screen.

- Source: https://titaniumsdk.com/docs/sdk/13.0.1/Titanium.UI.Android.Snackbar
- Titanium SDK version: 13.0.1
- Kind: view
- Platforms: Android
- Since: Titanium SDK 11.1.0
- Extends: Titanium.UI.View
- Inheritance: Titanium.UI.View > Titanium.Proxy

| Android |
| ------- |
| ![Android](./snackbar_android.png) |

For design guidelines, see
[Material design: Snackbars](https://material.io/components/snackbars)

## Example: Show a Snackbar

Display a Snackbar with an action button.

``` js
const win = Ti.UI.createWindow();
const btn = Ti.UI.createButton({
  title: 'show message'
});
btn.addEventListener('click', function() {
  snack.show();
});

const snack = Ti.UI.Android.createSnackbar({
  message: 'Hello Snackbar!',
  length: Ti.UI.Android.Snackbar.LENGTH_INDEFINITE,
  action: 'click me'
});
snack.addEventListener('click', function(e) {
  console.log(e.action);
});

win.add([btn, snack]);
win.open();
```

## Properties

### action

- Type: String
- Platforms: Android
- Since: Titanium SDK 10.2.0

Text of the right hand action button

### length

- Type: Number
- Platforms: Android
- Since: Titanium SDK 10.2.0
- Default: `LENGTH_SHORT`

Display time of the Snackbar

Use with on of the constants: `Ti.UI.Android.Snackbar.LENGTH_SHORT`,
`Ti.UI.Android.Snackbar.LENGTH_LONG` or
`Ti.UI.Android.Snackbar.LENGTH_INDEFINITE`

### LENGTH_INDEFINITE

- Type: Number
- Platforms: Android
- Permission: read-only

Use with `length` to specify the display time.

### LENGTH_LONG

- Type: Number
- Platforms: Android
- Permission: read-only

Use with `length` to specify the display time.

### LENGTH_SHORT

- Type: Number
- Platforms: Android
- Permission: read-only

Use with `length` to specify the display time.

### message

- Type: String
- Platforms: Android
- Since: Titanium SDK 10.2.0

Text of Snackbar

## Methods

### show

- Platforms: Android

Show the Snackbar

## Events

### click

- Platforms: Android

Fired when the action button is clicked

Event properties:

- `action` (String): The text of the action button.

## Inherited members

30 members are inherited. Each is documented on the type that declares it.

- [Titanium.Proxy](https://titaniumsdk.com/docs/sdk/13.0.1/Titanium.Proxy.md): `addEventListener`, `apiName`, `applyProperties`, `bubbleParent`, `fireEvent`, `lifecycleContainer`, `removeEventListener`
- [Titanium.UI.View](https://titaniumsdk.com/docs/sdk/13.0.1/Titanium.UI.View.md): `accessibilityDisableLongPress`, `elevation`, `filterTouchesWhenObscured`, `getViewById`, `hiddenBehavior`, `hide`, `id`, `insertAt`, `replaceAt`, `rotate`, `rotation`, `rotationX`, `rotationY`, `scaleX`, `scaleY`, `stopAnimation`, `tooltip`, `touchFeedback`, `touchFeedbackColor`, `transitionName`, `translationX`, `translationY`, `translationZ`

---

- This corpus documents Titanium SDK 13.4.1. Anything here that does not name a version describes 13.4.1.
- Titanium is maintained by TiDev. The Appcelerator toolchain is retired: there is no `appc` CLI, no Appcelerator Studio and no hosted build service. The supported CLI is `titanium` on npm, invoked as `ti`.

