Option
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
Whether the state is on or off.
Callback to be invoked when checked state changed, usually by a click action.
The modifier to be applied to the layout.
The optional leading icon. It is tint by OptionColors by default.
Defines the colors used by Option.See also OptionDefaults.optionColors.
Whether the option is enabled.
The shape used by Option.
The padding used by Option
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
}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
Whether the state is on or off.
Callback to be invoked when checked state changed, usually by a click action.
The modifier to be applied to the layout.
The optional leading icon. It is tint by OptionColors by default.
Defines the colors used by Option.See also OptionDefaults.optionColors.
Defines the vibrants used by Option.See also OptionDefaults.optionVibrants.
Whether the option is enabled.
The shape used by Option.
The padding used by Option
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
}