object SliderDefaults


Defaults used by slider.

Summary

Public functions

Unit
@Composable
DecreaseIcon(modifier: Modifier, contentDescription: String)

The recommended decrease icon.

Unit
@Composable
IncreaseIcon(modifier: Modifier, contentDescription: String)

The recommended 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 button icons.

Int

The maximum recommended number of steps for a segmented Slider.

String

The default content description for the decrease button

String

The default content description for the increase icon

Shape

The recommended Shape for Slider.

Public functions

DecreaseIcon

Added in 1.0.0-alpha32
@Composable
fun DecreaseIcon(
    modifier: Modifier = Modifier,
    contentDescription: String = decreaseIconContentDescription
): Unit

The recommended decrease icon.

Parameters
modifier: Modifier = Modifier

Modifier to be applied to the decrease icon.

contentDescription: String = decreaseIconContentDescription

The content description for the decrease icon.

IncreaseIcon

Added in 1.0.0-alpha32
@Composable
fun IncreaseIcon(
    modifier: Modifier = Modifier,
    contentDescription: String = increaseIconContentDescription
): Unit

The recommended increase icon.

Parameters
modifier: Modifier = Modifier

Modifier to be applied to the increase icon.

contentDescription: String = increaseIconContentDescription

The content description for the increase icon.

sliderColors

Added in 1.0.0-alpha32
@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-alpha32
@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-alpha32
val IconSizeDp

The recommended size for Slider button icons.

MaxSegmentSteps

Added in 1.0.0-alpha32
val MaxSegmentStepsInt

The maximum recommended number of steps for a segmented Slider.

decreaseIconContentDescription

Added in 1.0.0-alpha32
val decreaseIconContentDescriptionString

The default content description for the decrease button

increaseIconContentDescription

Added in 1.0.0-alpha32
val increaseIconContentDescriptionString

The default content description for the increase icon

shape

Added in 1.0.0-alpha32
val shapeShape

The recommended Shape for Slider.