NumberField
NumberField is used to create a number input field with increase and decrease buttons.
Parameters
The current value of the number field.
The callback that is triggered when the value changes.
The Modifier to be applied to the number field.
The icon to be displayed for the increase button.
The icon to be displayed for the decrease button.
The step length for increasing or decreasing the value.
The range of valid values for the number field.
The colors for the number field.
The size of the number field.
The corner size of the number field.
The gap between the text and buttons
Whether the number field is enabled.
Whether the number field is editable.
The text style for the number field.
The keyboard options for the number field.
Samples
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableIntStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue
import com.pico.spatial.ui.design.NumberField
import com.pico.spatial.ui.design.NumberFieldDefaults
fun main() {
//sampleStart
var value by remember { mutableIntStateOf(0) }
NumberField(value = value, onValueChange = { value = it })
//sampleEnd
}import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableIntStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue
import com.pico.spatial.ui.design.NumberField
import com.pico.spatial.ui.design.NumberFieldDefaults
fun main() {
//sampleStart
var value by remember { mutableIntStateOf(0) }
NumberField(
value = value,
onValueChange = { value = it },
size = NumberFieldDefaults.smallSize(),
)
//sampleEnd
}import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableIntStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue
import com.pico.spatial.ui.design.NumberField
import com.pico.spatial.ui.design.NumberFieldDefaults
fun main() {
//sampleStart
var value by remember { mutableIntStateOf(0) }
NumberField(value = value, onValueChange = { value = it }, valueRange = -100..100)
//sampleEnd
}import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableIntStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue
import com.pico.spatial.ui.design.NumberField
import com.pico.spatial.ui.design.NumberFieldDefaults
fun main() {
//sampleStart
var value by remember { mutableIntStateOf(0) }
NumberField(value = value, onValueChange = { value = it }, stepLength = 2)
//sampleEnd
}import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableIntStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue
import com.pico.spatial.ui.design.NumberField
import com.pico.spatial.ui.design.NumberFieldDefaults
fun main() {
//sampleStart
var value by remember { mutableIntStateOf(0) }
NumberField(value = value, onValueChange = { value = it }, editable = false)
//sampleEnd
}import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableIntStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue
import com.pico.spatial.ui.design.NumberField
import com.pico.spatial.ui.design.NumberFieldDefaults
fun main() {
//sampleStart
var value by remember { mutableIntStateOf(0) }
NumberField(value = value, onValueChange = { value = it }, enabled = false)
//sampleEnd
}NumberField is used to create a number input field with increase and decrease buttons.
Parameters
The current value of the number field.
The callback that is triggered when the value changes.
The Modifier to be applied to the number field.
The icon to be displayed for the increase button.
The icon to be displayed for the decrease button.
The step length for increasing or decreasing the value.
The range of valid values for the number field.
The colors for the number field.
The vibrants for the number field.
The size of the number field.
The corner size of the number field.
The gap between the text and buttons
Whether the number field is enabled.
Whether the number field is editable.
The text style for the number field.
The keyboard options for the number field.
Samples
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableIntStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue
import com.pico.spatial.ui.design.NumberField
import com.pico.spatial.ui.design.NumberFieldDefaults
fun main() {
//sampleStart
var value by remember { mutableIntStateOf(0) }
NumberField(value = value, onValueChange = { value = it })
//sampleEnd
}import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableIntStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue
import com.pico.spatial.ui.design.NumberField
import com.pico.spatial.ui.design.NumberFieldDefaults
fun main() {
//sampleStart
var value by remember { mutableIntStateOf(0) }
NumberField(
value = value,
onValueChange = { value = it },
size = NumberFieldDefaults.smallSize(),
)
//sampleEnd
}import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableIntStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue
import com.pico.spatial.ui.design.NumberField
import com.pico.spatial.ui.design.NumberFieldDefaults
fun main() {
//sampleStart
var value by remember { mutableIntStateOf(0) }
NumberField(value = value, onValueChange = { value = it }, valueRange = -100..100)
//sampleEnd
}import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableIntStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue
import com.pico.spatial.ui.design.NumberField
import com.pico.spatial.ui.design.NumberFieldDefaults
fun main() {
//sampleStart
var value by remember { mutableIntStateOf(0) }
NumberField(value = value, onValueChange = { value = it }, stepLength = 2)
//sampleEnd
}import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableIntStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue
import com.pico.spatial.ui.design.NumberField
import com.pico.spatial.ui.design.NumberFieldDefaults
fun main() {
//sampleStart
var value by remember { mutableIntStateOf(0) }
NumberField(value = value, onValueChange = { value = it }, editable = false)
//sampleEnd
}import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableIntStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue
import com.pico.spatial.ui.design.NumberField
import com.pico.spatial.ui.design.NumberFieldDefaults
fun main() {
//sampleStart
var value by remember { mutableIntStateOf(0) }
NumberField(value = value, onValueChange = { value = it }, enabled = false)
//sampleEnd
}