I just notice if you put a `TooltipArea` over a bu...
# compose-desktop
b
I just notice if you put a
TooltipArea
over a button it completely blocks the button and it becomes unusable. My searching showed a comment from 3 years ago where the only suggestion was to use a custom made alternative. Is the built in one still not really usable?
a
You can control the positioning of the tooltip.
Copy code
@OptIn(ExperimentalFoundationApi::class)
fun main() = singleWindowApplication {
    Box(Modifier.fillMaxSize(), contentAlignment = Alignment.Center) {
        TooltipArea(
            tooltip = {
                Text(
                    text = "This is a button",
                    Modifier.background(Color.Yellow).border(Dp.Hairline, Color.Black).padding(8.dp)
                )
            },
            tooltipPlacement = TooltipPlacement.ComponentRect(
                anchor = Alignment.TopCenter,
                alignment = Alignment.TopCenter
            )
        ) {
            Button(onClick = {}) {
                Text("Button")
            }
        }
    }
}
or
Copy code
tooltipPlacement = TooltipPlacement.CursorPoint(offset = DpOffset(16.dp, 16.dp))