> ## Documentation Index
> Fetch the complete documentation index at: https://docs.stac.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# SnackBar

> Documentation for SnackBar

Stac snackBar allows you to show the Flutter SnackBar using JSON.
To know more about the SnackBar widget in Flutter, refer to the [official documentation](https://api.flutter.dev/flutter/material/SnackBar-class.html).

## SnackBar Properties

| Property                | Type                   | Description                                                                           |
| ----------------------- | ---------------------- | ------------------------------------------------------------------------------------- |
| content                 | `StacWidget`           | The primary content of the snack bar.                                                 |
| backgroundColor         | `StacColor`            | The snack bar's background color.                                                     |
| elevation               | `double`               | The z-coordinate at which to place the snack bar.                                     |
| margin                  | `StacEdgeInsets`       | Empty space to surround the snack bar.                                                |
| padding                 | `StacEdgeInsets`       | The amount of padding to apply to the snack bar's content and optional action.        |
| width                   | `double`               | The width of the snack bar.                                                           |
| shape                   | `StacShapeBorder`      | The shape of the snack bar.                                                           |
| hitTestBehavior         | `StacHitTestBehavior`  | Defines how the snack bar area, including margin, will behave during hit testing.     |
| behavior                | `StacSnackBarBehavior` | This defines the behavior and location of the snack bar.                              |
| action                  | `StacSnackBarAction`   | An action that the user can take based on the snack bar.                              |
| actionOverflowThreshold | `double`               | The percentage threshold for action widget's width before it overflows to a new line. |
| showCloseIcon           | `bool`                 | Whether to include a close icon widget.                                               |
| closeIconColor          | `StacColor`            | An optional color for the close icon, if close icon visible.                          |
| duration                | `StacDuration`         | The duration for which the snack bar is visible.                                      |
| onVisible               | `StacAction`           | Called the first time that the snackbar is visible.                                   |
| dismissDirection        | `StacDismissDirection` | The direction in which the SnackBar can be dismissed.                                 |
| clipBehavior            | `StacClip`             | The content will be clipped (or not) according to this option.                        |

## SnackBarAction Properties

| Property                | Type                   | Description                                           |
| ----------------------- | ---------------------- | ----------------------------------------------------- |
| textColor               | `String`               | The button label color.                               |
| disabledTextColor       | `String`               | The button disabled label color.                      |
| backgroundColor         | `String`               | The button background fill color.                     |
| disabledBackgroundColor | `String`               | The button disabled label color.                      |
| label                   | `String`               | The button label.                                     |
| onPressed               | `Map<String, dynamic>` | The callback to be called when the button is pressed. |

## Example

<CodeGroup>
  ```dart Dart theme={null}
  StacSnackBarAction(
    content: StacText(data: 'This is a Snackbar'),
    action: StacSnackBarActionButton(
      label: 'Done',
      textColor: StacColors.blue,
      onPressed: StacNoneAction(),
    ),
    behavior: SnackBarBehavior.floating,
  )
  ```

  ```json JSON theme={null}
  {
    "actionType": "showSnackBar",
    "content": {
      "type": "text",
      "data": "This is a Snackbar"
    },
    "action": {
      "label": "Done",
      "textColor": "#73C2FB",
      "onPressed": {}
    },
    "behavior": "floating"
  }
  ```
</CodeGroup>
