Object

InputChipDefaults

Contains the default values used by InputChip.

RevenueCat

RevenueCat

Add subscriptions to your apps in minutes

Ad Get started for free
Android
@ExperimentalTvMaterial3Api
object InputChipDefaults

Contains the default values used by InputChip.

Properties

Android
val ContainerHeight = 36.dp

The height applied for an input chip. Note that you can override it by applying Modifier.height directly on a chip.

Android
val IconSize = 18.dp

The size of an Input chip icon

Android
val AvatarSize = 28.dp

The size of an Input chip avatar

Android
val ContainerShape = RoundedCornerShape(8.dp)

The default Shape applied to an input chip

Android
val ContainerShapeWithAvatar = RoundedCornerShape(36.dp)

The default Shape applied to an input chip with avatar

Functions

shape

fun shape(
        hasAvatar: Boolean,
        shape: Shape = if (hasAvatar) ContainerShapeWithAvatar else ContainerShape,
        focusedShape: Shape = shape,
        pressedShape: Shape = shape,
        selectedShape: Shape = shape,
        disabledShape: Shape = shape,
        focusedSelectedShape: Shape = shape,
        focusedDisabledShape: Shape = disabledShape,
        pressedSelectedShape: Shape = shape,
        selectedDisabledShape: Shape = disabledShape,
        focusedSelectedDisabledShape: Shape = disabledShape,
    ) =
        SelectableChipShape(
            shape = shape,
            focusedShape = focusedShape,
            pressedShape = pressedShape,
            selectedShape = selectedShape,
            disabledShape = disabledShape,
            focusedSelectedShape = focusedSelectedShape,
            focusedDisabledShape = focusedDisabledShape,
            pressedSelectedShape = pressedSelectedShape,
            selectedDisabledShape = selectedDisabledShape,
            focusedSelectedDisabledShape = focusedSelectedDisabledShape,
        )

Creates a SelectableChipShape that represents the default container shapes used in an InputChip

Parameters

hasAvatar changes the default shape based on whether the avatar composable is not null in the Chip
shape the shape used when the Chip is enabled, and has no other Interactions
focusedShape the shape used when the Chip is enabled and focused
pressedShape the shape used when the Chip is enabled and pressed
selectedShape the shape used when the Chip is enabled and selected
disabledShape the shape used when the Chip is not enabled
focusedSelectedShape the shape used when the Chip is enabled, focused and selected
focusedDisabledShape the shape used when the Chip is not enabled and focused
pressedSelectedShape the shape used when the Chip is enabled, pressed and selected
selectedDisabledShape the shape used when the Chip is not enabled and selected
focusedSelectedDisabledShape the shape used when the Chip is not enabled, focused and selected

colors

@ReadOnlyComposable
    @Composable
    fun colors(
        containerColor: Color = Color.Transparent,
        contentColor: Color = MaterialTheme.colorScheme.onSurfaceVariant,
        focusedContainerColor: Color = MaterialTheme.colorScheme.onSurface,
        focusedContentColor: Color = MaterialTheme.colorScheme.inverseOnSurface,
        pressedContainerColor: Color = MaterialTheme.colorScheme.onSurfaceVariant,
        pressedContentColor: Color = MaterialTheme.colorScheme.surface,
        selectedContainerColor: Color =
            MaterialTheme.colorScheme.secondaryContainer.copy(
                alpha = SelectedBackgroundColorOpacity
            ),
        selectedContentColor: Color = MaterialTheme.colorScheme.onSecondaryContainer,
        disabledContainerColor: Color =
            MaterialTheme.colorScheme.surfaceVariant.copy(alpha = DisabledBackgroundColorOpacity),
        disabledContentColor: Color =
            MaterialTheme.colorScheme.border.copy(alpha = DisabledContentColorOpacity),
        focusedSelectedContainerColor: Color = MaterialTheme.colorScheme.onPrimaryContainer,
        focusedSelectedContentColor: Color = MaterialTheme.colorScheme.onPrimary,
        pressedSelectedContainerColor: Color = MaterialTheme.colorScheme.secondary,
        pressedSelectedContentColor: Color = MaterialTheme.colorScheme.onSecondary,
    ) =
        SelectableChipColors(
            containerColor = containerColor,
            contentColor = contentColor,
            focusedContainerColor = focusedContainerColor,
            focusedContentColor = focusedContentColor,
            pressedContainerColor = pressedContainerColor,
            pressedContentColor = pressedContentColor,
            selectedContainerColor = selectedContainerColor,
            selectedContentColor = selectedContentColor,
            disabledContainerColor = disabledContainerColor,
            disabledContentColor = disabledContentColor,
            focusedSelectedContainerColor = focusedSelectedContainerColor,
            focusedSelectedContentColor = focusedSelectedContentColor,
            pressedSelectedContainerColor = pressedSelectedContainerColor,
            pressedSelectedContentColor = pressedSelectedContentColor,
        )

Creates a SelectableChipColors that represents the default container and content colors used in an InputChip

Parameters

containerColor the container color used when the Chip is enabled, and has no other Interactions
contentColor the content color used when the Chip is enabled, and has no other Interactions
focusedContainerColor the container color used when the Chip is enabled and focused
focusedContentColor the content color used when the Chip is enabled and focused
pressedContainerColor the container color used when the Chip is enabled and pressed
pressedContentColor the content color used when the Chip is enabled and pressed
selectedContainerColor the container color used when the Chip is enabled and selected
selectedContentColor the content color used when the Chip is enabled and selected
disabledContainerColor the container color used when the Chip is not enabled
disabledContentColor the content color used when the Chip is not enabled
focusedSelectedContainerColor the container color used when the Chip is enabled, focused and selected
focusedSelectedContentColor the content color used when the Chip is enabled, focused and selected
pressedSelectedContainerColor the container color used when the Chip is enabled, pressed and selected
pressedSelectedContentColor the content color used when the Chip is enabled, pressed and selected

scale

fun scale(
        @FloatRange(from = 0.0) scale: Float = 1f,
        @FloatRange(from = 0.0) focusedScale: Float = 1.1f,
        @FloatRange(from = 0.0) pressedScale: Float = scale,
        @FloatRange(from = 0.0) selectedScale: Float = scale,
        @FloatRange(from = 0.0) disabledScale: Float = scale,
        @FloatRange(from = 0.0) focusedSelectedScale: Float = focusedScale,
        @FloatRange(from = 0.0) focusedDisabledScale: Float = disabledScale,
        @FloatRange(from = 0.0) pressedSelectedScale: Float = scale,
        @FloatRange(from = 0.0) selectedDisabledScale: Float = disabledScale,
        @FloatRange(from = 0.0) focusedSelectedDisabledScale: Float = disabledScale,
    ) =
        SelectableChipScale(
            scale = scale,
            focusedScale = focusedScale,
            pressedScale = pressedScale,
            selectedScale = selectedScale,
            disabledScale = disabledScale,
            focusedSelectedScale = focusedSelectedScale,
            focusedDisabledScale = focusedDisabledScale,
            pressedSelectedScale = pressedSelectedScale,
            selectedDisabledScale = selectedDisabledScale,
            focusedSelectedDisabledScale = focusedSelectedDisabledScale,
        )

Creates a SelectableChipScale that represents the default scaleFactors used in an InputChip. scaleFactors are used to modify the size of a composable in different Interaction states e.g. 1f (original) in default state, 1.2f (scaled up) in focused state, 0.8f (scaled down) in pressed state, etc

Parameters

scale the scaleFactor used when the Chip is enabled, and has no other Interactions
focusedScale the scaleFactor used when the Chip is enabled and focused
pressedScale the scaleFactor used when the Chip is enabled and pressed
selectedScale the scaleFactor used when the Chip is enabled and selected
disabledScale the scaleFactor used when the Chip is not enabled
focusedSelectedScale the scaleFactor used when the Chip is enabled, focused and selected
focusedDisabledScale the scaleFactor used when the Chip is not enabled and focused
pressedSelectedScale the scaleFactor used when the Chip is enabled, pressed and selected
selectedDisabledScale the scaleFactor used when the Chip is not enabled and selected
focusedSelectedDisabledScale the scaleFactor used when the Chip is not enabled, focused and selected

border

@ReadOnlyComposable
    @Composable
    fun border(
        hasAvatar: Boolean,
        border: Border =
            Border(
                border = BorderStroke(width = 1.dp, color = MaterialTheme.colorScheme.border),
                shape = if (hasAvatar) ContainerShapeWithAvatar else ContainerShape,
            ),
        focusedBorder: Border = Border.None,
        pressedBorder: Border = focusedBorder,
        selectedBorder: Border =
            Border(
                border = BorderStroke(width = 1.dp, color = MaterialTheme.colorScheme.secondary),
                shape = if (hasAvatar) ContainerShapeWithAvatar else ContainerShape,
            ),
        disabledBorder: Border =
            Border(
                border =
                    BorderStroke(width = 1.dp, color = MaterialTheme.colorScheme.surfaceVariant),
                shape = if (hasAvatar) ContainerShapeWithAvatar else ContainerShape,
            ),
        focusedSelectedBorder: Border =
            Border(
                border =
                    BorderStroke(
                        width = 1.1.dp,
                        color = MaterialTheme.colorScheme.onPrimaryContainer,
                    ),
                shape = if (hasAvatar) ContainerShapeWithAvatar else ContainerShape,
            ),
        focusedDisabledBorder: Border = border,
        pressedSelectedBorder: Border = Border.None,
        selectedDisabledBorder: Border = Border.None,
        focusedSelectedDisabledBorder: Border = border,
    ) =
        SelectableChipBorder(
            border = border,
            focusedBorder = focusedBorder,
            pressedBorder = pressedBorder,
            selectedBorder = selectedBorder,
            disabledBorder = disabledBorder,
            focusedSelectedBorder = focusedSelectedBorder,
            focusedDisabledBorder = focusedDisabledBorder,
            pressedSelectedBorder = pressedSelectedBorder,
            selectedDisabledBorder = selectedDisabledBorder,
            focusedSelectedDisabledBorder = focusedSelectedDisabledBorder,
        )

Creates a SelectableChipBorder that represents the default Borders applied on an InputChip in different Interaction states

Parameters

hasAvatar changes the default border shape based on whether the avatar composable is not null in the Chip
border the Border used when the Chip is enabled, and has no other Interactions
focusedBorder the Border used when the Chip is enabled and focused
pressedBorder the Border used when the Chip is enabled and pressed
selectedBorder the Border used when the Chip is enabled and selected
disabledBorder the Border used when the Chip is not enabled
focusedSelectedBorder the Border used when the Chip is enabled, focused and selected
focusedDisabledBorder the Border used when the Chip is not enabled and focused
pressedSelectedBorder the Border used when the Chip is enabled, pressed and selected
selectedDisabledBorder the Border used when the Chip is not enabled and selected
focusedSelectedDisabledBorder the Border used when the Chip is not enabled, focused and selected

glow

fun glow(
        glow: Glow = Glow.None,
        focusedGlow: Glow = glow,
        pressedGlow: Glow = glow,
        selectedGlow: Glow = glow,
        focusedSelectedGlow: Glow = focusedGlow,
        pressedSelectedGlow: Glow = glow,
    ) =
        SelectableChipGlow(
            glow = glow,
            focusedGlow = focusedGlow,
            pressedGlow = pressedGlow,
            selectedGlow = selectedGlow,
            focusedSelectedGlow = focusedSelectedGlow,
            pressedSelectedGlow = pressedSelectedGlow,
        )

Creates a SelectableChipGlow that represents the default Glows used in an InputChip

Parameters

glow the Glow used when the Chip is enabled, and has no other Interactions
focusedGlow the Glow used when the Chip is enabled and focused
pressedGlow the Glow used when the Chip is enabled and pressed
selectedGlow the Glow used when the Chip is enabled and selected
focusedSelectedGlow the Glow used when the Chip is enabled, focused and selected
pressedSelectedGlow the Glow used when the Chip is enabled, pressed and selected