https://github.com/siddhesh2377/notification
Notification In Desktop Compose
https://github.com/siddhesh2377/notification
compose compose-desktop compose-multiplatform compose-notification compose-ui dekstop dekstop-app desktop-application kotlin notifications
Last synced: about 1 year ago
JSON representation
Notification In Desktop Compose
- Host: GitHub
- URL: https://github.com/siddhesh2377/notification
- Owner: Siddhesh2377
- License: gpl-3.0
- Created: 2024-06-03T15:01:49.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2024-06-03T15:22:18.000Z (about 2 years ago)
- Last Synced: 2025-06-13T11:03:03.075Z (about 1 year ago)
- Topics: compose, compose-desktop, compose-multiplatform, compose-notification, compose-ui, dekstop, dekstop-app, desktop-application, kotlin, notifications
- Language: Kotlin
- Homepage:
- Size: 20.5 KB
- Stars: 3
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Notification Composable

## Description
This is a Kotlin Jetpack Compose function to display notifications in your Desktop app. It creates a floating window with a customizable message and a close button.
## Usage
To use this Composable in your Desktop project, follow these steps:
1. Copy the `Notification` function into your project.
2. Call the `Notification` function where you want to display a notification, passing the text message and a callback function to handle closing the notification.
3. Customize the appearance and behavior of the notification window by modifying the parameters of the `Window` function.
## Example
```kotlin
// Display a simple notification
Notification(text = "Hello, world!") {
// Define the action to take when the notification is closed
// For example, you could update a state variable to hide the notification
// or perform any other necessary cleanup.
// e.g., isVisible.value = false
}
// Customize the notification window
Notification(
text = "Custom Notification",
onClose = {
// Define the action to take when the notification is closed
},
// Customize window properties
// For example, you can change the width, height, position, or appearance of the notification window.
windowProperties = WindowProperties(
width = 400.dp,
height = 100.dp,
placement = WindowPlacement.Floating,
position = WindowPosition(Alignment.TopEnd),
isResizable = false,
isUndecorated = true,
isTransparent = true
)
)