CamoButton
A button with a text label. appearance is its visual weight (null uses the theme's default), tone its
color family (Error for destructive actions). While loading, it shows a progress circle in place of the
text, keeps its width and focus, and ignores clicks. The parent sets the width (Modifier.fillMaxWidth()).
Usage
- Kotlin
- Dart
CamoButton(text = "Save", onClick = { save() })
// Weight and meaning
CamoButton("Cancel", onClick = cancel, appearance = Appearance.Ghost)
CamoButton("Delete", onClick = delete, appearance = Appearance.Outline, tone = Tone.Error)
// Loading: keeps its width and focus, ignores clicks
CamoButton("Saving", onClick = save, loading = true)
// Full width
CamoButton("Continue", onClick = next, modifier = Modifier.fillMaxWidth())
API
- Kotlin
- Dart
public fun CamoButton(
text: String,
onClick: () -> Unit,
modifier: Modifier = Modifier,
appearance: Appearance? = null,
tone: Tone = Tone.Default,
enabled: Boolean = true,
loading: Boolean = false,
prefixIcon: (@Composable () -> Unit)? = null,
suffixIcon: (@Composable () -> Unit)? = null,
interactionSource: MutableInteractionSource? = null,
)
| Name | Type | Default |
|---|---|---|
text | String | required |
onClick | () -> Unit | required |
modifier | Modifier | Modifier |
appearance | Appearance? | null |
tone | Tone | Tone.Default |
enabled | Boolean | true |
loading | Boolean | false |
prefixIcon | (@Composable () -> Unit)? | null |
suffixIcon | (@Composable () -> Unit)? | null |
interactionSource | MutableInteractionSource? | null |
Design notes
Why CamoButton works this way, its states and its edge cases: contributor docs.