object SliderDefaults


Defaults used by slider.

Summary

Public functions

Unit

Decrease Icon.

Unit

Increase Icon.

SliderColors

Creates a SliderColors that represents the default background and content colors used in an Slider.

SliderColors
@Composable
sliderColors(
    containerColor: Color,
    buttonIconColor: Color,
    selectedBarColor: Color,
    unselectedBarColor: Color,
    selectedBarSeparatorColor: Color,
    unselectedBarSeparatorColor: Color,
    disabledContainerColor: Color,
    disabledButtonIconColor: Color,
    disabledSelectedBarColor: Color,
    disabledUnselectedBarColor: Color,
    disabledSelectedBarSeparatorColor: Color,
    disabledUnselectedBarSeparatorColor: Color
)

Creates a SliderColors that represents the default background and content colors used in an Slider.

SliderColors

Creates a SliderColors as an alternative to the default colors, providing a visual indication of value changes within a Slider.

SliderColors
@Composable
variantSliderColors(
    containerColor: Color,
    buttonIconColor: Color,
    selectedBarColor: Color,
    unselectedBarColor: Color,
    selectedBarSeparatorColor: Color,
    unselectedBarSeparatorColor: Color,
    disabledContainerColor: Color,
    disabledButtonIconColor: Color,
    disabledSelectedBarColor: Color,
    disabledUnselectedBarColor: Color,
    disabledSelectedBarSeparatorColor: Color,
    disabledUnselectedBarSeparatorColor: Color
)

Creates a SliderColors as an alternative to the default colors, providing a visual indication of value changes within a Slider.

Public properties

Dp

The recommended size for Slider DecreaseIcon and IncreaseIcon button icons.

Int

The maximum recommended number of steps for a segmented Slider.

Shape

The recommended Shape for Slider.

Public functions

DecreaseIcon

Added in 1.0.0-alpha28
@Composable
fun DecreaseIcon(modifier: Modifier = Modifier): Unit

Decrease Icon.

IncreaseIcon

Added in 1.0.0-alpha28
@Composable
fun IncreaseIcon(modifier: Modifier = Modifier): Unit

Increase Icon.

sliderColors

Added in 1.0.0-alpha28
@Composable
fun sliderColors(): SliderColors

Creates a SliderColors that represents the default background and content colors used in an Slider.

sliderColors

@Composable
fun sliderColors(
    containerColor: Color = Color.Unspecified,
    buttonIconColor: Color = Color.Unspecified,
    selectedBarColor: Color = Color.Unspecified,
    unselectedBarColor: Color = Color.Unspecified,
    selectedBarSeparatorColor: Color = Color.Unspecified,
    unselectedBarSeparatorColor: Color = Color.Unspecified,
    disabledContainerColor: Color = Color.Unspecified,
    disabledButtonIconColor: Color = Color.Unspecified,
    disabledSelectedBarColor: Color = Color.Unspecified,
    disabledUnselectedBarColor: Color = Color.Unspecified,
    disabledSelectedBarSeparatorColor: Color = Color.Unspecified,
    disabledUnselectedBarSeparatorColor: Color = Color.Unspecified
): SliderColors

Creates a SliderColors that represents the default background and content colors used in an Slider.

Parameters
containerColor: Color = Color.Unspecified

The background color of this Slider when enabled

buttonIconColor: Color = Color.Unspecified

The color of the icon of buttons when enabled

selectedBarColor: Color = Color.Unspecified

The color of the progress bar when enabled

unselectedBarColor: Color = Color.Unspecified

The background color of the progress bar when enabled

selectedBarSeparatorColor: Color = Color.Unspecified

The color of separator between visible segments within the selected portion of the bar when enabled

unselectedBarSeparatorColor: Color = Color.Unspecified

The color of unselected separator between visible segments within the unselected portion of the bar when enabled

disabledContainerColor: Color = Color.Unspecified

The background color of this Slider when disabled

disabledButtonIconColor: Color = Color.Unspecified

The color of the icon of buttons when disabled

disabledSelectedBarColor: Color = Color.Unspecified

The color of the progress bar when disabled

disabledUnselectedBarColor: Color = Color.Unspecified

The background color of the progress bar when disabled

disabledSelectedBarSeparatorColor: Color = Color.Unspecified

The color of selected separator between visible segments when disabled

disabledUnselectedBarSeparatorColor: Color = Color.Unspecified

The color of unselected separator between visible segments when disabled

variantSliderColors

Added in 1.0.0-alpha28
@Composable
fun variantSliderColors(): SliderColors

Creates a SliderColors as an alternative to the default colors, providing a visual indication of value changes within a Slider.

Example of a slider uses variantSliderColors when its value is different from the initial value:

import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.wear.compose.material3.Slider
import androidx.wear.compose.material3.SliderDefaults

val initialValue = 4.5f
var value by remember { mutableStateOf(initialValue) }
Slider(
    value = value,
    onValueChange = { value = it },
    valueRange = 3f..6f,
    steps = 5,
    segmented = false,
    colors =
        if (value == initialValue) {
            SliderDefaults.sliderColors()
        } else {
            SliderDefaults.variantSliderColors()
        }
)

variantSliderColors

@Composable
fun variantSliderColors(
    containerColor: Color = Color.Unspecified,
    buttonIconColor: Color = Color.Unspecified,
    selectedBarColor: Color = Color.Unspecified,
    unselectedBarColor: Color = Color.Unspecified,
    selectedBarSeparatorColor: Color = Color.Unspecified,
    unselectedBarSeparatorColor: Color = Color.Unspecified,
    disabledContainerColor: Color = Color.Unspecified,
    disabledButtonIconColor: Color = Color.Unspecified,
    disabledSelectedBarColor: Color = Color.Unspecified,
    disabledUnselectedBarColor: Color = Color.Unspecified,
    disabledSelectedBarSeparatorColor: Color = Color.Unspecified,
    disabledUnselectedBarSeparatorColor: Color = Color.Unspecified
): SliderColors

Creates a SliderColors as an alternative to the default colors, providing a visual indication of value changes within a Slider.

Example of a slider uses variantSliderColors when its value is different from the initial value:

import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.wear.compose.material3.Slider
import androidx.wear.compose.material3.SliderDefaults

val initialValue = 4.5f
var value by remember { mutableStateOf(initialValue) }
Slider(
    value = value,
    onValueChange = { value = it },
    valueRange = 3f..6f,
    steps = 5,
    segmented = false,
    colors =
        if (value == initialValue) {
            SliderDefaults.sliderColors()
        } else {
            SliderDefaults.variantSliderColors()
        }
)
Parameters
containerColor: Color = Color.Unspecified

The background color of this Slider when enabled

buttonIconColor: Color = Color.Unspecified

The color of the icon of buttons when enabled

selectedBarColor: Color = Color.Unspecified

The color of the progress bar when enabled

unselectedBarColor: Color = Color.Unspecified

The background color of the progress bar when enabled

selectedBarSeparatorColor: Color = Color.Unspecified

The color of separator between visible segments within the selected portion of the bar when enabled

unselectedBarSeparatorColor: Color = Color.Unspecified

The color of unselected separator between visible segments within the unselected portion of the bar when enabled

disabledContainerColor: Color = Color.Unspecified

The background color of this Slider when disabled

disabledButtonIconColor: Color = Color.Unspecified

The color of the icon of buttons when disabled

disabledSelectedBarColor: Color = Color.Unspecified

The color of the progress bar when disabled

disabledUnselectedBarColor: Color = Color.Unspecified

The background color of the progress bar when disabled

disabledSelectedBarSeparatorColor: Color = Color.Unspecified

The color of selected separator between visible segments when disabled

disabledUnselectedBarSeparatorColor: Color = Color.Unspecified

The color of unselected separator between visible segments when disabled

Public properties

IconSize

Added in 1.0.0-alpha28
val IconSizeDp

The recommended size for Slider DecreaseIcon and IncreaseIcon button icons.

MaxSegmentSteps

Added in 1.0.0-alpha28
val MaxSegmentStepsInt

The maximum recommended number of steps for a segmented Slider.

shape

Added in 1.0.0-alpha28
val shapeShape

The recommended Shape for Slider.