Search code examples
androidtooltipandroid-jetpack-compose

How to show tooltip in android jetpack compose


I am trying to add a simple tooltip in my app UI for FAB, IconButton, Menu, etc.

Example tooltip

How to add this in jetpack compose?
I am familiar with how to add using XML and programmatically as mentioned here.

Limitations with those methods - trying to avoid XML as much as possible and for programmatic approach, there is no findViewById in compose for obvious reasons.

Refered Jetpack Docs, Codelabs and Samples.
Got nothing related to the tooltip.

Any help is appreciated.

Note
Not looking for any customizations, plain and simple tooltip would do.
And preferable no 3rd party libs.

Update
Anyone having the same requirement, please bump up this issue created.


Solution

  • There is no official tooltip support yet in Jetpack Compose.

    You could probably build something on top of androidx.compose.ui.window.Popup(...)

    Also I'd check out TextDelegate, to measure the text in order to know where & how to position the tooltip/popup.