Tenugui is a ModalBottomSheet wrapper for Jetpack Compose.
Handling BottomSheetDialog in Jetpack Compose can be tricky because:
compose-materialandcompose-material3have different implementations:compose-material: A generic Compose implementation that requires handling scrims and wrapping with ModalBottomSheetLayout.compose-material3:- 1.1.X, 1.2.X: Generic Compose implementation, drawn on the window.
- 1.3.X and later: Uses
ComposeView, drawn onComponentDialog.
compose-materialdoes not draw on the window, whilecompose-material3has unstable APIsTenuguiallows you to useBottomSheetDialogwithout depending oncompose-materialorcompose-material3.
- If you're using
compose-materialbut want to leverage the BottomSheetBehavior API. - If you're using
compose-material31.1.X or 1.2.X. - If you're using
compose-material31.3.X or later, you do not need Tenugui. 👍
Note
If compose-material provides a built-in BottomSheetDialog API in the future, Tenugui will no longer be necessary.
- Uses BottomSheetDialog to show a modal bottom sheet.
- Supports BottomSheetBehavior API in Compose.
- Handles various dismiss interactions, such as back key presses and outside touches.
var visible by remember { mutableStateOf(false) }
if (visible) {
val bottomSheetDialogState = rememberBottomSheetDialogState()
BottomSheetDialog(
onDismissRequest = {
visible = false
},
state = bottomSheetDialogState,
) {
Text("Text on BottomSheetDialog!!!")
}
}That's it! You can now use BottomSheetDialog with Tenugui.
Important
PopupPositionProvider has positioning issues.
If cursor handle positioning is important, it's recommended to use EditText with AndroidView.
implementation 'io.github.ryunen344.tenugui:tenugui:$version'Copyright (C) 2017 The Android Open Source Project
Copyright (C) 2025 RyuNen344
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