Components / Actions

Floating Action Button

A small floating button for a primary action above content.

CupertinoSmallFloatingActionButton View source ↗

Playground

Live Compose · Wasm
Preview

Click or drag inside the preview to try it out.

Properties

Usage example

Kotlin code for the current playground settings.

Example.kt
kotlin
import androidx.compose.runtime.*import androidx.compose.foundation.layout.*import androidx.compose.ui.Modifierimport androidx.compose.ui.unit.dpimport zone.ien.hig.*import zone.ien.hig.theme.*import zone.ien.hig.icons.CupertinoIconsimport zone.ien.hig.icons.filled.Heartimport androidx.compose.foundation.Imageimport androidx.compose.ui.layout.ContentScaleimport org.jetbrains.compose.resources.painterResourceimport zone.ien.hig.composeapp.generated.resources.Resimport zone.ien.hig.composeapp.generated.resources.glass_landscapeimport androidx.compose.foundation.backgroundimport com.kyant.backdrop.backdrops.rememberLayerBackdropimport com.kyant.backdrop.backdrops.layerBackdropimport androidx.compose.ui.graphics.Colorimport androidx.compose.ui.Alignment
@OptIn(ExperimentalCupertinoApi::class)@Composablefun Example() { CupertinoTheme(colorScheme = lightColorScheme(accent = Color(0xFF007AFF))) { val backdrop = rememberLayerBackdrop() Box(Modifier.fillMaxSize()) { Image(painterResource(Res.drawable.glass_landscape), contentDescription = null, modifier = Modifier.matchParentSize().layerBackdrop(backdrop), contentScale = ContentScale.Crop) Column(Modifier.fillMaxSize(), verticalArrangement = Arrangement.spacedBy(16.dp, Alignment.CenterVertically)) { CupertinoSmallFloatingActionButton(onClick = { /* 작업 실행 */ }, backdrop = backdrop) { CupertinoIcon(CupertinoIcons.Filled.Heart, contentDescription = "Like") } } } }}

Run examples inside CupertinoTheme. For components using backdrop, attach layerBackdrop to the background content.

The background uses the sample app's glass_landscape resource. Replace it with an image from your project.