
Product
Introducing Socket Fix for Safe, Automated Dependency Upgrades
Automatically fix and test dependency updates with socket fix—a new CLI tool that turns CVE alerts into safe, automated upgrades.
com.github.skgmn:composetooltip
Advanced tools
implementation "com.github.skgmn:composetooltip:0.2.0"
Tooltip
can be either used inside ConstraintLayout or displayed as a popup.
ConstraintLayout {
val someImage = createRef()
Image(
painter = painterResource(R.drawable.some_image),
contentDescription = "Some image"
modifier = Modifier.constrainAs(someImage) {
// Place it where you want
}
)
Tooltip(
anchor = someImage,
anchorEdge = AnchorEdge.Top,
) {
Text("This is my image!")
}
}
fun ConstraintLayoutScope.Tooltip(
anchor: ConstrainedLayoutReference,
anchorEdge: AnchorEdge,
modifier: Modifier = Modifier,
tooltipStyle: TooltipStyle = rememberTooltipStyle(),
tipPosition: EdgePosition = remember { EdgePosition() },
anchorPosition: EdgePosition = remember { EdgePosition() },
margin: Dp = 8.dp,
content: @Composable RowScope.() -> Unit
)
anchor
- ConstrainedLayoutReference
to locate this tooltip nearbyanchorEdge
- Can be either of AnchorEdge.Start
, AnchorEdge.Top
, AnchorEdge.End
, or AnchorEdge.Bottom
tooltipStyle
- Style for tooltip. Can be created by rememberTooltipStyle
tipPosition
- Tip position relative to balloonanchorPosition
- Position on the anchor
's edge where the tip points out.margin
- Margin between tip and anchor
content
- Content inside balloon. Typically Text
.Tooltip
also supports enter/exit transition using AnimatedVisibility
. Because AnimatedVisibility
is experimental, this method is also experimental.
fun ConstraintLayoutScope.Tooltip(
anchor: ConstrainedLayoutReference,
anchorEdge: AnchorEdge,
enterTransition: EnterTransition,
exitTransition: ExitTransition,
modifier: Modifier = Modifier,
visible: Boolean = true,
tooltipStyle: TooltipStyle = rememberTooltipStyle(),
tipPosition: EdgePosition = remember { EdgePosition() },
anchorPosition: EdgePosition = remember { EdgePosition() },
margin: Dp = 8.dp,
content: @Composable RowScope.() -> Unit
)
enterTransition
- EnterTransition
to be applied when the visible
becomes true. Types of EnterTransition
are listed here.exitTransition
- ExitTransition
to be applied when the visible
becomes false. Types of ExitTransition
are listed here.Box {
// Some other composables here
// This Box is a conatiner for anchoring
Box {
Image(
painter = painterResource(R.drawable.some_image),
contentDescription = "Some image"
)
Tooltip(
anchorEdge = AnchorEdge.Top,
) {
Text("This is my image!")
}
}
}
When Tooltip
is being displayed as a popup, an anchor and Tooltip
should be put altogether inside one composable.
fun Tooltip(
anchorEdge: AnchorEdge,
modifier: Modifier = Modifier,
tooltipStyle: TooltipStyle = rememberTooltipStyle(),
tipPosition: EdgePosition = remember { EdgePosition() },
anchorPosition: EdgePosition = remember { EdgePosition() },
margin: Dp = 8.dp,
onDismissRequest: (() -> Unit)? = null,
properties: PopupProperties = remember { PopupProperties() },
content: @Composable RowScope.() -> Unit
)
onDismissRequest
- Executes when the user clicks outside of the tooltip.properties
- PopupProperties
for further customization of this tooltip's behavior.Other parameteres are same as for ConstraintLayout.
There is also an another version of supporting transition.
FAQs
Tooltip library for Jetpack Compose
We found that com.github.skgmn:composetooltip demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Automatically fix and test dependency updates with socket fix—a new CLI tool that turns CVE alerts into safe, automated upgrades.
Security News
CISA denies CVE funding issues amid backlash over a new CVE foundation formed by board members, raising concerns about transparency and program governance.
Product
We’re excited to announce a powerful new capability in Socket: historical data and enhanced analytics.