clickable on Any Composable
Make non-button elements tappable.
Anything Can Be Tappable
Sometimes you want a whole card or row to respond to taps, not a button. The clickable modifier makes any composable react. 👆
The clickable Modifier
Add Modifier.clickable to any element and pass an onClick lambda. The element now handles taps just like a button.
Text(
"Open profile",
modifier = Modifier.clickable { open() }
)All lessons in this course
- Button and onClick
- Text, Outlined & Icon Buttons
- Enabled, Disabled & Loading States
- clickable on Any Composable