Design Snackbars and Alert Dialogs in Jetpack Compose
To show alerts like snackbar or dialog is a common task in the modern android application. In this article, you’re going to learn everything about how to display snackbar and alert dialog in Jetpack Compose.
Note: Jetpack Compose recently moved to beta. This means there will no longer be any drastic changes in the API structure. So it would be a great time to learn how to work with this next-generation UI kit for Android development. Layouts are the basic building blocks of the UI, so enjoy the article.
You will need to install Android Studio Canary, Arctic Fox (2020.3.1) version to use the Jetpack Compose beta.
Prerequisites
Before going any further you must have basic knowledge on how to work with Jetpack Compose. If you’re new to compose I highly recommend you to go through the following articles.
- “Jetpack Compose Components (Part 1)”
- “Build Android Layouts in JetPack Compose”
- “Theming in Jetpack Compose for Android”
- “Navigation With Jetpack Compose in Android”
Snackbar
Its snackbar time in jetpack compose. Snackbar provides us a way to display the non-blocking alerts to the users. Out of the box, we can use…