androidx.compose.material3

ButtonGroupScopeSince 1.10

Interface

No hand-written docs yet.

Button group scope used to indicate a Modifier.weight and Modifier.animateWidth of a child element. Also defines the DSL to build the content of a ButtonGroup

interface ButtonGroupScope

Used by

Parameters that take a ButtonGroupScope.

Functions

weight

fun Modifier.weight(weight: Float): Modifier

Size the element's width proportional to its weight relative to other weighted sibling elements in the ButtonGroup. The parent will divide the horizontal space remaining after measuring unweighted child elements and distribute it according to this weight.

animateWidth

fun Modifier.animateWidth(
    interactionSource: InteractionSource,
    compressionLimit: PaddingValues = ButtonDefaults.ContentPadding,
): Modifier

Specifies the interaction source to use with this item. This is used to listen to events and animate growing the pressed button and shrink the neighbor(s).

alignSince 1.11

fun Modifier.align(alignment: Alignment.Vertical): Modifier

Align the element vertically within the ButtonGroup. This alignment will have priority over the ButtonGroup's verticalAlignment parameter.

clickableItem

fun clickableItem(
    onClick: () -> Unit,
    label: String,
    icon: (@Composable () -> Unit)? = null,
    weight: Float = Float.NaN,
    enabled: Boolean = true,
)

Adds a clickable item to the ButtonGroup.

toggleableItem

fun toggleableItem(
    checked: Boolean,
    label: String,
    onCheckedChange: (Boolean) -> Unit,
    icon: (@Composable () -> Unit)? = null,
    weight: Float = Float.NaN,
    enabled: Boolean = true,
)

Adds a toggleable item to the ButtonGroup.

customItem

fun customItem(
    buttonGroupContent: @Composable () -> Unit,
    menuContent: @Composable (ButtonGroupMenuState) -> Unit,
)

Adds a custom item to the ButtonGroup.

Library docs

Button group scope used to indicate a Modifier.weight and Modifier.animateWidth of a child element. Also defines the DSL to build the content of a ButtonGroup