We just launched Compose Examples featuring over 150+ components! Check it out →

CircleIconButton

Android

Component in Jetpack Glance

Intended to fill the role of secondary icon button. Background color may be null to have the button display as an icon with a 48x48dp hit area.

Last updated:

Installation

dependencies {
   implementation("androidx.glance:glance-appwidget:1.1.1")
}

Overloads

@Composable
fun CircleIconButton(
    imageProvider: ImageProvider,
    contentDescription: String?,
    onClick: () -> Unit,
    modifier: GlanceModifier = GlanceModifier,
    enabled: Boolean = true,
    backgroundColor: ColorProvider? = GlanceTheme.colors.background,
    contentColor: ColorProvider = GlanceTheme.colors.onSurface,
    key: String? = null
)

Parameters

namedescription
imageProviderthe icon to be drawn in the button
contentDescriptionText used by accessibility services to describe what this imagerepresents. This text should be localized, such as by usingandroidx.compose.ui.res.stringResource or similar
onClickThe action to be performed when this button is clicked.
modifierThe modifier to be applied to this button.
enabledIf false, the button will not be clickable.
backgroundColorThe color to tint the button's background. May be null to make backgroundtransparent.
contentColorThe color to tint the button's icon.
keyA stable and unique key that identifies the action for this button. This ensuresthat the correct action is triggered, especially in cases of items that change order. If notprovided we use the key that is automatically generated by the Compose runtime, which is uniquefor every exact code location in the composition tree.
@Composable
fun CircleIconButton(
    imageProvider: ImageProvider,
    contentDescription: String?,
    onClick: Action,
    modifier: GlanceModifier = GlanceModifier,
    enabled: Boolean = true,
    backgroundColor: ColorProvider? = GlanceTheme.colors.background,
    contentColor: ColorProvider = GlanceTheme.colors.onSurface,
)

Parameters

namedescription
imageProviderthe icon to be drawn in the button
contentDescriptionText used by accessibility services to describe what this imagerepresents. This text should be localized, such as by usingandroidx.compose.ui.res.stringResource or similar
onClickThe action to be performed when this button is clicked.
modifierThe modifier to be applied to this button.
enabledIf false, the button will not be clickable.
backgroundColorThe color to tint the button's background. May be null to make backgroundtransparent.
contentColorThe color to tint the button's icon.
by @alexstyl