Ask AI
Skip to main content

Show a snackbar

Function: Show a snackbar

This action displays a small, temporary message at the bottom of the screen, often used to provide quick feedback to users about an action they've just performed. It's perfect for confirming successful operations, warning about issues, or simply informing the user without interrupting their workflow.

Input

  • Text: The message you want to display in the snackbar. This could be a confirmation, a warning, or any short piece of information.
  • Time active: The duration, in milliseconds, that the snackbar will remain visible on the screen before automatically disappearing. For example, 1000 means 1 second, 3000 means 3 seconds. If you don't specify a value, it will default to 2000 milliseconds (2 seconds).

Output

This action does not produce any direct output that can be used in subsequent steps. Its primary purpose is to display a visual message to the user.

Execution Flow

Real-Life Examples

Here are some practical ways you can use the "Show a snackbar" action in your application:

Example 1: Confirming a successful data save

Imagine a form where users submit their contact information. After they click "Save," you want to let them know the data was successfully stored.

  • Inputs:
    • Text: "Your contact information has been saved successfully!"
    • Time active: 3000
  • Result: A snackbar appears at the bottom of the screen for 3 seconds, displaying the message "Your contact information has been saved successfully!".

Example 2: Notifying about an item added to a shopping cart

When a customer adds an item to their online shopping cart, a quick confirmation can enhance their experience.

  • Inputs:
    • Text: "Product added to your cart."
    • Time active: (Left blank, using default)
  • Result: A snackbar appears at the bottom of the screen for 2 seconds (the default duration), displaying the message "Product added to your cart.".

Example 3: Warning about an incomplete form submission

If a user tries to submit a form but misses a required field, you can use a snackbar to gently remind them.

  • Inputs:
    • Text: "Please complete all required fields before submitting."
    • Time active: 5000
  • Result: A snackbar appears at the bottom of the screen for 5 seconds, displaying the message "Please complete all required fields before submitting.".