FloatingActionButton

fun FloatingActionButton(icon: Painter, onClick: () -> Unit, modifier: Modifier = Modifier, text: String = "", contentDescription: String? = null, interactionSource: MutableInteractionSource = remember { MutableInteractionSource() })

A sticky button that floats over the content of the page. It always has the highest level of emphasis on the screen.

It supports the primary navigation and offers the user a fast option to navigate.

Floating Action Button Sample

Parameters

icon

The Painter for the icon to display.

onClick

The action to perform when the button is clicked.

modifier

An optional Modifier to be applied to the FloatingActionButton. Defaults to Modifier.

text

An optional text to be displayed in the button. If empty, the text will not be displayed.

contentDescription

An optional optional content description for accessibility. If not provided, text will be used.

interactionSource

An optional hoisted MutableInteractionSource for observing and emitting Interactions for the button. You can use this to change the button's appearance or preview the button in different states. Defaults to a remembered MutableInteractionSource.