
Lightweight library for seamless cross-platform message display in apps, offering custom Snackbar UI, toast messages, alert dialogs with shared API, custom actions, and duration control.
Compose CrossMessages is a simple and lightweight library for displaying messages across Android
and iOS using Jetpack Compose Multiplatform (KMP).
It currently supports:
AlertDialog on AndroidUIAlertController on iOSdependencies {
implementation("io.github.berkaykirecci:crossmessages:$version")
}val snackbarState = rememberSnackbarState()
MultiPlatformSnackbar(state = snackbarState)
snackbarState.success("Success Message")
snackbarState.warning("Warning Message")
snackbarState.error("Error Message")
snackbarState.info("Info Message")CompositionLocalProvider(
LocalSnackbarColors provides DefaultSnackbarColors(success = Color.Green)
) {
val snackbarState = rememberSnackbarState()
MultiPlatformSnackbar(state = snackbarState)
snackbarState.success("Success Message")
}snackbarState.show(
SnackbarModel(
message = "Custom Message",
backgroundColor = Color.Black,
duration = 3000L,
showActionButton = true,
actionButtonModel = ActionButtonModel(
iconRes = Res.drawable.action_btn,
onActionClick = { }
),
leadingIconModel = LeadingIconModel(
iconRes = Res.drawable.icon,
iconTint = Color.LightGray,
iconSize = 18.dp
),
textModel = TextModel(
textColor = Color.Yellow,
textAlignment = TextAlign.Center
),
alignment = Alignment.TopCenter
)
)val toastState = rememberToastState()
Toast(state = toastState)
toastState.show("Toast Message")val alertState = rememberAlertState()
Alert(state = alertState)
alertState.show(
AlertModel(
message = "Alert Message",
title = "Alert Title",
actions = listOf(
DialogAction("Ok", ActionStyle.DEFAULT),
DialogAction("Cancel", ActionStyle.CANCEL)
)
)
)Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Pull requests and issues are welcome!
Compose CrossMessages is a simple and lightweight library for displaying messages across Android
and iOS using Jetpack Compose Multiplatform (KMP).
It currently supports:
AlertDialog on AndroidUIAlertController on iOSdependencies {
implementation("io.github.berkaykirecci:crossmessages:$version")
}val snackbarState = rememberSnackbarState()
MultiPlatformSnackbar(state = snackbarState)
snackbarState.success("Success Message")
snackbarState.warning("Warning Message")
snackbarState.error("Error Message")
snackbarState.info("Info Message")CompositionLocalProvider(
LocalSnackbarColors provides DefaultSnackbarColors(success = Color.Green)
) {
val snackbarState = rememberSnackbarState()
MultiPlatformSnackbar(state = snackbarState)
snackbarState.success("Success Message")
}snackbarState.show(
SnackbarModel(
message = "Custom Message",
backgroundColor = Color.Black,
duration = 3000L,
showActionButton = true,
actionButtonModel = ActionButtonModel(
iconRes = Res.drawable.action_btn,
onActionClick = { }
),
leadingIconModel = LeadingIconModel(
iconRes = Res.drawable.icon,
iconTint = Color.LightGray,
iconSize = 18.dp
),
textModel = TextModel(
textColor = Color.Yellow,
textAlignment = TextAlign.Center
),
alignment = Alignment.TopCenter
)
)val toastState = rememberToastState()
Toast(state = toastState)
toastState.show("Toast Message")val alertState = rememberAlertState()
Alert(state = alertState)
alertState.show(
AlertModel(
message = "Alert Message",
title = "Alert Title",
actions = listOf(
DialogAction("Ok", ActionStyle.DEFAULT),
DialogAction("Cancel", ActionStyle.CANCEL)
)
)
)Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Pull requests and issues are welcome!