SplitToggleChip

Composable Component

A SplitToggleChip is a specialized type of Chip that includes a slot for a toggle control, such as a toggle or checkbox. The SplitToggleChip differs from the ToggleChip by having two "tappable" areas, one clickable and one toggleable.

Android
@Composable
public fun SplitToggleChip(
    checked: Boolean,
    onCheckedChange: (Boolean) -> Unit,
    label: @Composable RowScope.() -> Unit,
    onClick: () -> Unit,
    toggleControl: @Composable BoxScope.() -> Unit,
    modifier: Modifier = Modifier,
    secondaryLabel: @Composable (RowScope.() -> Unit)? = null,
    colors: SplitToggleChipColors = ToggleChipDefaults.splitToggleChipColors(),
    enabled: Boolean = true,
    checkedInteractionSource: MutableInteractionSource? = null,
    clickInteractionSource: MutableInteractionSource? = null,
    contentPadding: PaddingValues = ToggleChipDefaults.ContentPadding,
    shape: Shape = MaterialTheme.shapes.large,
): Unit

Parameters

checkedBoolean flag indicating whether this button is currently checked.
onCheckedChangeCallback to be invoked when this buttons checked status is changed.
labelA slot for providing the chip's main label. The contents are expected to be text which is "start" aligned.
onClickClick listener called when the user clicks the main body of the chip, the area behind the labels.
toggleControlA slot for providing the chip's toggle controls(s). Two built-in types of toggle control are supported, see Checkbox and Switch. For RadioButton, use SelectableChip instead. ImageVectors can be obtained from ToggleChipDefaults.switchIcon, ToggleChipDefaults.radioIcon and ToggleChipDefaults.checkboxIcon. In order to correctly render when the Chip is not enabled the icon must set its alpha value to LocalContentAlpha.
modifierModifier to be applied to the chip
secondaryLabelA slot for providing the chip's secondary label. The contents are expected to be "start" or "center" aligned. label and secondaryLabel contents should be consistently aligned.
colorsSplitToggleChipColors that will be used to resolve the background and content color for this chip in different states, see ToggleChipDefaults.splitToggleChipColors.
enabledControls the enabled state of the chip. When false, this chip will not be clickable
checkedInteractionSourcean optional hoisted MutableInteractionSource for observing and emitting Interactions for this chip's "toggleable" tap area. You can use this to change the chip's appearance or preview the chip in different states. Note that if null is provided, interactions will still happen internally.
clickInteractionSourcean optional hoisted MutableInteractionSource for observing and emitting Interactions for this chip's "clickable" tap area. You can use this to change the chip's appearance or preview the chip in different states. Note that if null is provided, interactions will still happen internally.
contentPaddingThe spacing values to apply internally between the container and the content
shapeDefines the chip's shape. It is strongly recommended to use the default as this shape is a key characteristic of the Wear Material Theme