IconContentSwitcher

fun IconContentSwitcher(options: List<Painter>, selectedOption: Painter, onOptionSelected: (Painter) -> Unit, modifier: Modifier = Modifier, size: ContentSwitcherSize = ContentSwitcherSize.Medium, isEnabled: Boolean = true, optionsContentDescriptions: Map<Painter, String?> = emptyMap())

Content switcher - Icon variant

Content switchers allow users to toggle between two or more content sections within the same space on the screen.

Content switchers are frequently used to let users toggle between different formattings, like a grid view and a table view. They are also often used to narrow large content groups or to sort related content. For example, a messaging tool may use a content switcher to divide messages into three views such as “All,” “Read,” and “Unread.”

(From Content switcher documentation)

Parameters

options

A list of Painters representing the options to be displayed. Each painter identifies an option and is used as the displayed icon. At least two options are required, otherwise, an IllegalArgumentException will be thrown.

selectedOption

The currently selected option.

onOptionSelected

Callback invoked when an option is selected. The painter of the selected option is passed as a parameter.

modifier

The modifier to be applied to the content switcher.

size

The ContentSwitcherSize to be applied to the content switcher. Defaults to ContentSwitcherSize.Medium.

isEnabled

Whether the content switcher is enabled or disabled.

optionsContentDescriptions

A map of Painters to their content descriptions. This map is used to provide content descriptions for each option.