Composable Function

RemoteButtonGroup

Layout component to implement an expressive group of buttons in a row.

RemoteButtonGroup

Source set: Android
@Composable
public fun RemoteButtonGroup(
    modifier: RemoteModifier = RemoteModifier,
    spacing: RemoteDp = RemoteButtonGroupDefaults.Spacing,
    expansionWidth: RemoteDp = RemoteButtonGroupDefaults.ExpansionWidth,
    contentPadding: RemotePaddingValues = RemoteButtonGroupDefaults.fullWidthPaddings(),
    verticalAlignment: RemoteAlignment.Vertical = RemoteAlignment.CenterVertically,
    content: @RemoteComposable @Composable (RemoteButtonGroupScope.() -> Unit),
)

Layout component to implement an expressive group of buttons in a row.

Each button in a RemoteButtonGroup should apply at least one RemoteButtonGroupScope modifier (RemoteButtonGroupScope.weight, RemoteButtonGroupScope.minWidth, or RemoteButtonGroupScope.animateWidth) to participate in width distribution. With RemoteButtonGroupScope.animateWidth, pressing a button expands its width by expansionWidth while its neighboring button(s) shrink accordingly, with the spatial springs of RemoteMaterialTheme.motionScheme. The press animation needs a profile that supports touch actions.

Example of a RemoteButtonGroup with 3 equal-width buttons:

Example of 3 buttons, the middle one bigger, that animate their width on press:

Parameters

modifier Modifier to be applied to the button group
spacing the amount of spacing between buttons
expansionWidth the additional width (delta) added to a pressed button's resting width, rather than an absolute target width, while its neighboring button(s) shrink by the same total amount. Non-positive values result in no width expansion when pressed.
contentPadding The spacing values to apply internally between the container and the content
verticalAlignment the vertical alignment of the button group's children.
content the content and properties of each button. The UX guidance is to use no more than 3 buttons within a RemoteButtonGroup.
Jetpack Compose beyond MaterialFree components, screens and templates for apps that don’t look like Google’s. Copy them into your app, or let your coding agent add them.Browse for free

Content updated: