ToggleIconButton
Toggleable icon button defined by PICO design
Parameters
whether the state is on or off
callback to be invoked when toggleable is clicked, therefore the change of the state in requested
The modifier to be applied to the layout
The ToggleButtonColors used by button to resolve background color and content color in different states
size used by IconButton
the content will be clipped to this Shape.
whether this toggleable will handle input events and appear enabled for semantics purposes
MutableInteractionSource that will be used to dispatch PressInteraction.Press when this clickable is pressed. Only the initial (first) press will be recorded and dispatched with MutableInteractionSource.
the content of this icon button, typically an Icon
Samples
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.RowScope
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.Modifier
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import com.pico.spatial.ui.design.ToggleIconButton
fun main() {
//sampleStart
var isChecked by remember { mutableStateOf(false) }
ToggleIconButton(checked = isChecked, onCheckedChange = { isChecked = !isChecked }) {
AnyIcon()
}
//sampleEnd
}Toggleable icon button defined by PICO design
Parameters
whether the state is on or off
callback to be invoked when toggleable is clicked, therefore the change of the state in requested
The modifier to be applied to the layout
The ToggleButtonColors used by button to resolve background color and content color in different states
The ToggleButtonVibrants used by button to resolve background vibrancy and content vibrancy in different states.
size used by IconButton
the content will be clipped to this Shape.
whether this toggleable will handle input events and appear enabled for semantics purposes
MutableInteractionSource that will be used to dispatch PressInteraction.Press when this clickable is pressed. Only the initial (first) press will be recorded and dispatched with MutableInteractionSource.
the content of this icon button, typically an Icon
Samples
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.RowScope
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.Modifier
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import com.pico.spatial.ui.design.ToggleIconButton
fun main() {
//sampleStart
var isChecked by remember { mutableStateOf(false) }
ToggleIconButton(checked = isChecked, onCheckedChange = { isChecked = !isChecked }) {
AnyIcon()
}
//sampleEnd
}