<div class='type'>Composable Component</div>



Layout component to implement an expressive group of buttons in a row, that react to touch by
growing the touched button, (while the neighbor(s) shrink to accommodate and keep the group width
constant).

<a id='references'></a>



<h2 id="buttongroup-modifier-spacing-expansionwidth-contentpadding-verticalalignment-transformation-content">ButtonGroup</h2>

<div class='sourceset sourceset-android'>Android</div>


```kotlin
@Composable
public fun ButtonGroup(
    modifier: Modifier = Modifier,
    spacing: Dp = ButtonGroupDefaults.Spacing,
    expansionWidth: Dp = ButtonGroupDefaults.ExpansionWidth,
    contentPadding: PaddingValues = ButtonGroupDefaults.fullWidthPaddings(),
    verticalAlignment: Alignment.Vertical = Alignment.CenterVertically,
    transformation: SurfaceTransformation? = null,
    content: @Composable ButtonGroupScope.() -> Unit,
)
```


#### Parameters

| | |
| --- | --- |
| modifier | Modifier to be applied to the button group |
| spacing | the amount of spacing between buttons |
| expansionWidth | how much buttons grow 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. |
| transformation | The transformation for the ButtonGroup when it's inside a dynamically changing container. To prevent a "double transformation" (on both the group and its buttons), individual `Button`s inside this group must have their own container transformations disabled; only their content should be transformed. |
| content | the content and properties of each button. The Ux guidance is to use no more than 3 buttons within a ButtonGroup. Note that this content is on the `ButtonGroupScope`, to provide access to 3 new modifiers to configure the buttons. |




<div class='sourceset sourceset-android'>Android</div>


> **Deprecated** This overload is deprecated. Please use the new overload with the transformation parameter.



<hr class="docs-overload-divider">


<h2 id="buttongroup-modifier-spacing-expansionwidth-contentpadding-verticalalignment-content">ButtonGroup</h2>

```kotlin
@Composable
public fun ButtonGroup(
    modifier: Modifier = Modifier,
    spacing: Dp = ButtonGroupDefaults.Spacing,
    expansionWidth: Dp = ButtonGroupDefaults.ExpansionWidth,
    contentPadding: PaddingValues = ButtonGroupDefaults.fullWidthPaddings(),
    verticalAlignment: Alignment.Vertical = Alignment.CenterVertically,
    content: @Composable ButtonGroupScope.() -> Unit,
)
```


#### Parameters

| | |
| --- | --- |
| modifier | Modifier to be applied to the button group |
| spacing | the amount of spacing between buttons |
| expansionWidth | how much buttons grow 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 ButtonGroup. Note that this content is on the `ButtonGroupScope`, to provide access to 3 new modifiers to configure the buttons. |