KMM Material Tooltip
A Kotlin Multiplatform Material Design Tooltip library for Android and iOS platforms using Jetpack Compose.
Overview
KMM Material Tooltip provides a customizable tooltip implementation that follows Material Design principles while working seamlessly across Android and iOS through Kotlin Multiplatform. The library offers various tooltip positions, customizable appearance, and interactive capabilities.
Features
- Multiple Positioning Options: Position tooltips at TopLeft, TopRight, BottomLeft, BottomRight, Left, or Right of the target element
- Customizable Appearance: Control corner radius, caret size, and spacing
- Interactive Elements: Add leading and trailing icons with onClick actions
- Material Design Integration: Seamlessly works with Material 3 theme colors and styles
Installation
Add the dependency to your shared module's build.gradle.kts:
commonMain.dependencies {
implementation("io.github.zaiddev1996:kmm-material-tooltip:1.0.0")
}
Usage
Basic Example
Customization Options
AppTooltip(
state = tooltipState,
content = TooltipContent(
text = StringResource("Custom tooltip with icons"),
leadingIcon = DrawableResource("ic_info"),
trailingIcon = DrawableResource("ic_close"),
textStyle = MaterialTheme.typography.labelMedium,
onLeadingIconClick = { },
onTrailingIconClick = { }
),
config = TooltipConfig(
horizontalSpacing = 10,
verticalSpacing = 5,
caretWidth = 30f,
caretHeight = ,
caretSpacing =
),
position = TooltipPosition.BottomRight,
radius = TooltipRadius.Small,
onDismiss = { }
) {
}
Tooltip Positions
TooltipPosition.TopLeft: Positions the tooltip at the top-left of the target
TooltipPosition.TopRight: Positions the tooltip at the top-right of the target
TooltipPosition.BottomLeft: Positions the tooltip at the bottom-left of the target
Corner Radius Options
TooltipRadius.Small: 8dp radius
TooltipRadius.Medium: 12dp radius
TooltipRadius.Full: Pills shaped (fully rounded)
Contributing
Contributions are welcome! Feel free to submit pull requests or create issues for any bugs or feature requests.
License
This project is licensed under the Apache 2.0 License - see the LICENSE file for details.