-
Notifications
You must be signed in to change notification settings - Fork 2
clipboard README
github-actions[bot] edited this page Jun 2, 2026
·
1 revision
Zero-configuration cross-platform clipboard for Kotlin Multiplatform.
Copy, paste, check, and observe the system clipboard across all KMP platforms — no setup, no config class, no DI. Just import and use.
| Platform | Copy | Read | Observe |
|---|---|---|---|
| Android | ✅ | ✅ | ✅ (lifecycle-aware) |
| iOS | ✅ | ✅ | ✅ (foreground change detection) |
| macOS | ✅ | ✅ | ✅ (polling + changeCount) |
| tvOS | ✅ | ✅ | ✅ |
| watchOS | ✅ | ✅ | ✅ |
| JVM | ✅ | ✅ | ✅ (FlavorListener) |
| JS | ✅ | ❌ | Limited (visibility change) |
| Wasm JS | ✅ | ❌ | Limited |
| Linux | ✅ | ✅ | Limited (polling, requires xclip/xsel) |
| Windows | ✅ | ✅ | Limited (polling) |
| WASI | ❌ | ❌ | ❌ |
import com.mobilebytelabs.kmptoolkit.clipboard.copyToClipboard
import com.mobilebytelabs.kmptoolkit.clipboard.getFromClipboard
import com.mobilebytelabs.kmptoolkit.clipboard.hasClipboardText
import com.mobilebytelabs.kmptoolkit.clipboard.clearClipboard
// Copy
val success = copyToClipboard("Hello, World!")
// Read
val text: String? = getFromClipboard()
// Check
if (hasClipboardText()) { /* enable paste button */ }
// Clear
clearClipboard()// Copy text — returns true if initiated successfully
fun copyToClipboard(text: String): Boolean
// Read text — returns null if empty, unsupported, or non-text
fun getFromClipboard(): String?
// Check if clipboard has text content
fun hasClipboardText(): Boolean
// Clear clipboard
fun clearClipboard()import com.mobilebytelabs.kmptoolkit.clipboard.createClipboardObserver
import com.mobilebytelabs.kmptoolkit.clipboard.rememberClipboardObserver
// In a ViewModel / coroutine scope
val observer = createClipboardObserver()
observer.startObserving()
observer.clipboardContent.collect { content ->
println("Clipboard changed: $content")
}
observer.stopObserving()
// In Compose (lifecycle-managed)
@Composable
fun MyScreen() {
val observer = rememberClipboardObserver()
val content by observer.clipboardContent.collectAsState()
Text("Clipboard: $content")
}interface ClipboardObserver {
val clipboardContent: StateFlow<String?>
val isObserving: Boolean
fun startObserving()
fun stopObserving()
}-
JS:
copyToClipboardis fire-and-forget (async write) — always returnstrue -
JS / Wasm:
getFromClipboard()returnsnull(async API, read not supported synchronously) -
Linux: requires
xcliporxselinstalled on the system - WASI: no clipboard access available in runtime
- SETUP.md — Integration steps
-
CLAUDE_AI_SETUP.md — AI-assisted setup with
/sync-clipboard
** Partials**
App Intents
Bubble
Clipboard
Cookbook
- Clipboard Copy Text
- Clipboard Read Text
- Consumer Anon Key Setup
- Crashlytics Attribution Per Library
- Ifonline Block
- Index
- Index
- Index
- Index
- Open Url Compose
- Pick And Share Image
- React To Offline
- Register Firebase Hooks
- Share Pdf Android
- Share Text
- Wifi Vs Cellular
Firebase Analytics
In App Update
Intent Launcher
Inter App Comms
Modules
- Cmp App Intents
- Cmp App Intents Compose
- Cmp Bubble
- Cmp Clipboard
- Cmp Deep Link
- Cmp Firebase Analytics
- Cmp In App Update
- Cmp Intent Launcher
- Cmp Intent Launcher Compose
- Cmp Library
- Cmp Network Monitor
- Cmp Network Monitor Compose
- Cmp Observe
- Cmp Observe Koin
- Cmp Open Url
- Cmp Pdf Generator
- Cmp Product Tickets
- Cmp Remote Config
- Cmp Share
- Cmp Share Compose
- Cmp Toast
Network Monitor
Open Url
Pdf Generator
Remote Config
Share
Toast
User Tickets
General