IconToggleButtonDefaults

object IconToggleButtonDefaults


Contains default values used by IconToggleButtons.

Summary

Public functions

Shape

Provides a Shape that uses the default Glimmer shapes for buttons and animates transitions between states.

IconToggleButtonColors
@Composable
colors(
    backgroundColor: Color,
    checkedBackgroundColor: Color,
    contentColor: Color,
    checkedContentColor: Color
)

Creates IconToggleButtonColors with default values for an IconToggleButton.

Shape
@Composable
shape(checked: Boolean, checkedShape: Shape, uncheckedShape: Shape)

Chooses a Shape based on the checked state and can be used to override the default Glimmer button shapes.

Public properties

PaddingValues

Default content padding used for an IconToggleButton.

Public functions

animateShape

Added in 1.0.0-alpha12
@Composable
fun animateShape(checked: Boolean): Shape

Provides a Shape that uses the default Glimmer shapes for buttons and animates transitions between states. If you require an animated transition between your own custom shapes, please consider creating a custom animated shape.

Parameters
checked: Boolean

whether the button is in the checked state

colors

Added in 1.0.0-alpha12
@Composable
fun colors(
    backgroundColor: Color = GlimmerTheme.colors.surface,
    checkedBackgroundColor: Color = GlimmerTheme.colors.outline,
    contentColor: Color = calculateContentColor(backgroundColor),
    checkedContentColor: Color = calculateContentColor(checkedBackgroundColor)
): IconToggleButtonColors

Creates IconToggleButtonColors with default values for an IconToggleButton.

Parameters
backgroundColor: Color = GlimmerTheme.colors.surface

The background color when the button is unchecked.

checkedBackgroundColor: Color = GlimmerTheme.colors.outline

The background color when the button is checked.

contentColor: Color = calculateContentColor(backgroundColor)

The content color when the button is unchecked.

checkedContentColor: Color = calculateContentColor(checkedBackgroundColor)

The content color when the button is checked.

shape

Added in 1.0.0-alpha12
@Composable
fun shape(
    checked: Boolean,
    checkedShape: Shape = ToggleButtonDefaults.CheckedShape,
    uncheckedShape: Shape = GlimmerTheme.shapes.large
): Shape

Chooses a Shape based on the checked state and can be used to override the default Glimmer button shapes. Note that it simply switches shapes without animation.

If you require an animated version, please refer to IconToggleButtonDefaults.animateShape, which uses default Glimmer animations and shapes, or consider creating a custom animated shape.

Parameters
checked: Boolean

whether the button is in the checked state

checkedShape: Shape = ToggleButtonDefaults.CheckedShape

the shape of the button when it is checked

uncheckedShape: Shape = GlimmerTheme.shapes.large

the shape of the button when it is unchecked

Public properties

contentPadding

val contentPaddingPaddingValues

Default content padding used for an IconToggleButton.