{"id":15132436,"url":"https://github.com/radusalagean/info-bar-compose","last_synced_at":"2026-01-11T18:04:19.437Z","repository":{"id":40656083,"uuid":"388717815","full_name":"radusalagean/info-bar-compose","owner":"radusalagean","description":"An Android Jetpack Compose library for displaying on-screen messages. (simplified Snackbar alternative)","archived":false,"fork":false,"pushed_at":"2025-05-30T09:30:57.000Z","size":1573,"stargazers_count":131,"open_issues_count":0,"forks_count":8,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-09-29T00:32:18.988Z","etag":null,"topics":["android","android-library","android-ui","jetpack-compose","kotlin","material-design","snackbar"],"latest_commit_sha":null,"homepage":"","language":"Kotlin","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/radusalagean.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2021-07-23T07:37:34.000Z","updated_at":"2025-06-22T13:10:44.000Z","dependencies_parsed_at":"2025-05-30T10:41:35.450Z","dependency_job_id":"d6ef2f75-bbc5-45ab-9c47-bc6166debbee","html_url":"https://github.com/radusalagean/info-bar-compose","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/radusalagean/info-bar-compose","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/radusalagean%2Finfo-bar-compose","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/radusalagean%2Finfo-bar-compose/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/radusalagean%2Finfo-bar-compose/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/radusalagean%2Finfo-bar-compose/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/radusalagean","download_url":"https://codeload.github.com/radusalagean/info-bar-compose/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/radusalagean%2Finfo-bar-compose/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28317303,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-11T14:58:17.114Z","status":"ssl_error","status_checked_at":"2026-01-11T14:55:53.580Z","response_time":60,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["android","android-library","android-ui","jetpack-compose","kotlin","material-design","snackbar"],"created_at":"2024-09-26T04:04:45.658Z","updated_at":"2026-01-11T18:04:19.403Z","avatar_url":"https://github.com/radusalagean.png","language":"Kotlin","funding_links":[],"categories":["Libraries"],"sub_categories":["UI"],"readme":"[![Maven Central](https://img.shields.io/maven-central/v/com.radusalagean/info-bar-compose?color=green\u0026logoColor=green)](https://search.maven.org/artifact/com.radusalagean/info-bar-compose)\n[![Android Arsenal]( https://img.shields.io/badge/Android%20Arsenal-InfoBar%20Compose-green.svg?style=flat )]( https://android-arsenal.com/details/1/8254)\n\n# InfoBar Compose\n\nAn **Android Jetpack Compose library** for displaying **on-screen messages**. Unlike the built-in `Snackbar` from the Compose Material library, the `InfoBar` can be properly displayed **without additional requirements**, like `Scaffold`, `SnackbarHost` / `SnackbarHostState`, or manually starting new coroutines to show the on-screen message.\n\nAlthough the **InfoBar** composable is inspired by the Snackbar, it does not aim to entirely copy its design or behavior.\n\n**Test drive this library, demo app available on [Google Play](https://play.google.com/store/apps/details?id=com.radusalagean.infobarcompose.sample)!**\n\n![standard_info_bar_with_string_title_no_wrap_1080x181](https://user-images.githubusercontent.com/11408459/129848671-33911961-549d-4ef1-8160-2a3cbb0ecfc4.png)\n![standard_info_bar_with_string_title_and_action_1080x181](https://user-images.githubusercontent.com/11408459/129848673-c63f64d3-53d9-4d22-b080-fe89566e4491.png)\n\n## Usage\n\nInclude the library in your module-level `build.gradle` file:\n```\nrepositories {\n    mavenCentral()\n}\n\ndependencies {\n    implementation 'com.radusalagean:info-bar-compose:1.0.0'\n}\n```\n\nThe **simplest configuration** of an `InfoBar` is showcased below:\n\n```kotlin\nvar message: InfoBarMessage? by remember { mutableStateOf(null) }\n\n// Assign the message on an event callback (button click, download complete, message received, etc.):\n// message = InfoBarMessage(text = \"Example message\")\n\nInfoBar(offeredMessage = message) {\n    // ⚠️ Important step: We are nulling out the message in the trailing lambda (onDismiss function)\n    message = null\n}\n```\n\nA **complete working example**:\n```kotlin\nsetContent {\n    YourAppTheme {\n        Box(Modifier.fillMaxSize().padding(16.dp)) {\n            var message: InfoBarMessage? by remember { mutableStateOf(null) }\n            Button(\n                modifier = Modifier.align(Alignment.Center),\n                onClick = { message = InfoBarMessage(text = \"Example message\") }\n            ) {\n                Text(\"Show message\")\n            }\n            InfoBar(offeredMessage = message) {\n                message = null\n            }\n        }\n    }\n}\n```\n![simple-usage](https://user-images.githubusercontent.com/11408459/129697170-36e7f019-1189-493e-ad99-0d753da1f357.gif)\n\n## `InfoBar` types\n\nThe `InfoBar` composable has 2 signatures:\n- One for a **standard** version, which already has a layout defined, inspired by the Material design `Snackbar`. This composable has multiple parameters exposed, allowing for increased customizability of the predefined standard layout.\n- One for a **generic** version, allowing to pass a composable layout defined in the client app.\n\n## Configuration parameters\n### **`InfoBar` composable:**\n\n| S | G |\n| --- | --- |\n| Available in the **Standard** `InfoBar` | Available in the **Generic** `InfoBar` |\n\n\n\n| Parameter | Description | Type | S | G |\n| --- | --- | --- | --- | --- |\n| `modifier` | Modifier to be applied to the `InfoBar` surface | `Modifier` | ✔️ | ✔️ |\n| `offeredMessage` | `InfoBarMessage` or `BaseInfoBarMessage` subclass instance, describing the message that should be displayed | `InfoBarMessage?` | ✔️ | ✔️ |\n| `elevation` | Elevation to be applied to the `InfoBar` surface | `Dp` | ✔️ | ✔️ |\n| `shape` | Shape to be applied to the `InfoBar` surface | `Shape` | ✔️ | ✔️ |\n| `backgroundColor` | Background color to be applied to the `InfoBar` surface | `Color?` | ✔️ | ✔️ |\n| `content` | The content composable to use in the `InfoBar` surface | `@Composable (T) -\u003e Unit` | ❌ | ✔️ |\n| `textVerticalPadding` | Vertical padding for the message text | `Dp` | ✔️ | ❌ |\n| `textColor` | Color for the message text | `Color?` | ✔️ | ❌ |\n| `textFontSize` | Font size for the message text | `TextUnit` | ✔️ | ❌ |\n| `textFontStyle` | Font style for the message text | `FontStyle?` | ✔️ | ❌ |\n| `textFontWeight` | Font weight for the message text | `FontWeight?` | ✔️ | ❌ |\n| `textFontFamily` | Font family for the message text | `FontFamily?` | ✔️ | ❌ |\n| `textLetterSpacing` | Letter spacing for the message text | `TextUnit` | ✔️ | ❌ |\n| `textDecoration` | Decoration for the message text | `TextDecoration?` | ✔️ | ❌ |\n| `textAlign` | Alignment for the message text | `TextAlign?` | ✔️ | ❌ |\n| `textLineHeight` | Line height for the message text | `TextUnit` | ✔️ | ❌ |\n| `textMaxLines` | Maximum number of lines for the message text | `Int` | ✔️ | ❌ |\n| `textStyle` | Style for the message text | `TextStyle` | ✔️ | ❌ |\n| `actionColor` | Color for the action button text | `Color?` | ✔️ | ❌ |\n| `fadeEffect` | Use fading effect when the message appears and disappears? (controls the `alpha` property) | `Boolean` | ✔️ | ✔️ |\n| `fadeEffectEasing` | Easing style of the fade effect | `InfoBarEasing` | ✔️ | ✔️ |\n| `scaleEffect` | Use scaling effect when the message appears and disappears? (controls the `scaleX` / `scaleY` properties) | `Boolean` | ✔️ | ✔️ |\n| `scaleEffectEasing` | Easing style of the scale effect | `InfoBarEasing` | ✔️ | ✔️ |\n| `slideEffect` | Which sliding effect to use when the message appears and disappears? (controls the `translationY` property) | `InfoBarSlideEffect` | ✔️ | ✔️ |\n| `slideEffectEasing` | Easing style of the slide effect | `InfoBarEasing` | ✔️ | ✔️ |\n| `enterTransitionMillis` | Enter animation duration in milliseconds | `Int` | ✔️ | ✔️ |\n| `exitTransitionMillis` | Exit animation duration in milliseconds | `Int` | ✔️ | ✔️ |\n| `wrapInsideExpandedBox` | Maintain the shadow of the `InfoBar` even when animating the `alpha` property, by wrapping the `InfoBar` content inside a `Box` layout that fills the maximum available space. The `alpha` property is then animated on the outer `Box` instead of the `InfoBar` surface, thus not clipping the shadow when `alpha` is less than `1f`. **Note: Any modifier you pass from the outside is applied to the `InfoBar` surface, not the outer `Box` layout!** | `Boolean` | ✔️ | ✔️ |\n| `onDismiss` | Function which is called when the `InfoBar` is either timed out or dismissed by the user. **Don't forget to always null out the `InfoBarMessage` / `BaseInfoBarMessage` subclass instance here!** (see usage example from above) |  `() -\u003e Unit` | ✔️ | ✔️ |\n\n### **`InfoBarMessage` class:**\n\n| Parameter | Description | Type |\n| --- | --- | --- |\n| `text` | Message as string | `String?` |\n| `textStringResId` | Message as string resource id | `Int?` |\n| `textStringResArgs` | Arguments for `textStringResId` | `Array\u003cAny\u003e?` |\n| `textColor` | Color for the message text (overrides `textColor` set in the `InfoBar` composable) | `Color?` |\n| `action` | Action as string | `String?` |\n| `actionStringResId` | Action as string resource id | `Int?` |\n| `actionStringResArgs` | Arguments for `actionStringResId` | `Array\u003cAny\u003e?` |\n| `actionColor` | Color for the action button text (overrides `actionColor` set in the `InfoBar` composable) | `Color?` |\n| `backgroundColor` | Background color to be applied to the `InfoBar` surface (overrides `backgroundColor` set in the `InfoBar` composable) | `Color?` |\n| `displayTimeSeconds` | The number of seconds to display the message (excluding animation time). Pass `-1` if you don't want the message to time out. | `Int?` |\n| `onAction` | Function which is called when the user presses the action button | `(() -\u003e Unit)?` |\n\n## Using the generic composable\n\nIf the standard `InfoBar` signature does not entirely meet your requirements in terms of layout, you can use the **generic** `InfoBar` signature, which allows you to pass a custom layout composable:\n\n1. **Extend the `BaseInfoBarMessage` abstract class** and define your custom message data structure:\n    ```kotlin\n    class CustomMessage(\n        val textString: String,\n        val icon: ImageVector,\n        val iconColor: Color,\n        val textColor: Color = Color.Unspecified,\n        override val backgroundColor: Color? = null,\n        override val displayTimeSeconds: Int? = 4,\n    ) : BaseInfoBarMessage() {\n        override val containsControls: Boolean = false\n    }\n    ```\n1. **Declare the `content` composable** that defines your layout:\n   \n    ```kotlin\n    val content: @Composable (CustomMessage) -\u003e Unit = { message -\u003e\n        Row {\n            Icon(\n                modifier = Modifier.padding(8.dp).align(Alignment.CenterVertically),\n                imageVector = message.icon,\n                contentDescription = null,\n                tint = message.iconColor\n            )\n            Text(\n                modifier = Modifier.align(Alignment.CenterVertically),\n                text = message.textString,\n                color = message.textColor\n            )\n        }\n    }\n    ```\n1. **Display** the message:\n    ```kotlin\n    setContent {\n        YourAppTheme {\n            Box(Modifier.fillMaxSize().padding(16.dp)) {\n                var message: CustomMessage? by remember { mutableStateOf(null) }\n                Button(\n                    modifier = Modifier.align(Alignment.Center),\n                    onClick = { \n                        message = CustomMessage(\n                            textString = \"This is a custom message\",\n                            textColor = Color(0xFF414141),\n                            icon = Icons.Rounded.Info,\n                            iconColor = Color(0xFF27C54D),\n                            backgroundColor = Color(0xFFE3F1E6)\n                        )\n                    }\n                ) {\n                    Text(\"Show message\")\n                }\n                InfoBar(offeredMessage = message, content = content) {\n                    message = null\n                }\n            }\n        }\n    }\n    ```\n    ![custom-usage](https://user-images.githubusercontent.com/11408459/129857424-bcbfb2d6-00d0-4a1d-8bbc-19a2e01d78c5.gif)\n\n## Sample App\n\nMore complex usage examples are available in the **sample app**. [Download from Google Play](https://play.google.com/store/apps/details?id=com.radusalagean.infobarcompose.sample).\n\n![sample-app](https://user-images.githubusercontent.com/11408459/129859255-85e4f667-7601-49a6-9175-72cc372670ce.gif)\n\n**Photo credits:** The sample app contains 2 photos, used under [Pexels](https://www.pexels.com/license/) license. The authors of these photos are [Kittichai Chumanee](https://www.pexels.com/@kittichai-chumanee-3743016) and [Karolina Grabowska](https://www.pexels.com/@karolina-grabowska).\n\n## Contributions\n\nFound a bug or have a suggestion? Please open an [issue](https://github.com/radusalagean/info-bar-compose/issues).\n\n## Support\n\nIf you use this library and enjoy it, please support it by **starring** it on GitHub. 🌟\n\n## Further reading\n\nThere is an [article](https://radusalagean.com/jetpack-compose-snackbar-alternative-infobar-compose-library/) available that showcases this library in a bit more detail.\n\n## License\nApache License 2.0, see the [LICENSE](LICENSE) file for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fradusalagean%2Finfo-bar-compose","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fradusalagean%2Finfo-bar-compose","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fradusalagean%2Finfo-bar-compose/lists"}