Option
@Composable
Option is a stylized button component defined by PICO design witch has a selected state. And usually has a Text and optional leading icon.
Parameters
selected
Whether the state is on or off.
onSelectChange
Callback to be invoked when checked state changed, usually by a click action.
modifier
The modifier to be applied to the layout.
icon
The optional leading icon. It is tint by OptionColors by default.
colors
Defines the colors used by Option.See also OptionDefaults.optionColors.
enabled
Whether the option is enabled.
shape
The shape used by Option.
contentPadding
The padding used by Option
interactionSource
MutableInteractionSource that will be used to dispatch hover and press events.
Samples
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue
import androidx.compose.ui.res.painterResource
import com.pico.spatial.ui.design.Icon
import com.pico.spatial.ui.design.Option
import com.pico.spatial.ui.design.Text
fun main() {
//sampleStart
var checked by remember { mutableStateOf(false) }
Option(
selected = checked,
onSelectChange = { checked = !checked },
icon = {
Icon(
painter = painterResource(R.drawable.ic_sample_circle_placeholder),
contentDescription = null,
)
},
) {
Text("label")
}
//sampleEnd
}