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.

Color

Returns the checked, unfocused background Color for an IconToggleButton derived from the provided baseColor.

IconToggleButtonColors
@Composable
colors(
    backgroundColor: Color,
    focusedBackgroundColor: Color,
    checkedBackgroundColor: Color,
    focusedCheckedBackgroundColor: Color,
    contentColor: Color,
    focusedContentColor: Color,
    checkedContentColor: Color,
    focusedCheckedContentColor: Color
)

Creates IconToggleButtonColors with default values for an IconToggleButton.

Color

Returns the unchecked, focused background Color for an IconToggleButton derived from the provided baseColor.

Color

Returns the checked, focused background Color for an IconToggleButton derived from the provided baseColor.

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

Shape

Default shape for IconToggleButton in the checked state.

PaddingValues

Default content padding used for an IconToggleButton.

Public functions

animatedShape

Added in 1.0.0-alpha22
@Composable
fun animatedShape(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

checkedBackgroundColor

Added in 1.0.0-alpha22
@Composable
fun checkedBackgroundColor(baseColor: Color = GlimmerTheme.colors.primary): Color

Returns the checked, unfocused background Color for an IconToggleButton derived from the provided baseColor.

baseColor is not the final color. It is a brand or accent color, which is adjusted to a tone that is suitable for use as a checked background.

Parameters
baseColor: Color = GlimmerTheme.colors.primary

the brand or accent Color to derive from, such as Colors.primary

Returns
Color

the background Color for the button when checked and unfocused

colors

Added in 1.0.0-alpha22
@Composable
fun colors(
    backgroundColor: Color = GlimmerTheme.colors.surface,
    focusedBackgroundColor: Color = focusedBackgroundColor(backgroundColor),
    checkedBackgroundColor: Color = checkedBackgroundColor(),
    focusedCheckedBackgroundColor: Color = focusedCheckedBackgroundColor(checkedBackgroundColor),
    contentColor: Color = calculateContentColor(backgroundColor),
    focusedContentColor: Color = calculateContentColor(focusedBackgroundColor),
    checkedContentColor: Color = calculateContentColor(checkedBackgroundColor),
    focusedCheckedContentColor: Color = calculateContentColor(focusedCheckedBackgroundColor)
): IconToggleButtonColors

Creates IconToggleButtonColors with default values for an IconToggleButton.

Parameters
backgroundColor: Color = GlimmerTheme.colors.surface

the background color when the button is unchecked and unfocused

focusedBackgroundColor: Color = focusedBackgroundColor(backgroundColor)

the background color when the button is unchecked and focused

checkedBackgroundColor: Color = checkedBackgroundColor()

the background color when the button is checked and unfocused

focusedCheckedBackgroundColor: Color = focusedCheckedBackgroundColor(checkedBackgroundColor)

the background color when the button is checked and focused. Defaults to a color derived from checkedBackgroundColor

contentColor: Color = calculateContentColor(backgroundColor)

the content color when the button is unchecked and unfocused

focusedContentColor: Color = calculateContentColor(focusedBackgroundColor)

the content color when the button is unchecked and focused

checkedContentColor: Color = calculateContentColor(checkedBackgroundColor)

the content color when the button is checked and unfocused

focusedCheckedContentColor: Color = calculateContentColor(focusedCheckedBackgroundColor)

the content color when the button is checked and focused

focusedBackgroundColor

Added in 1.0.0-alpha22
@Composable
fun focusedBackgroundColor(baseColor: Color = GlimmerTheme.colors.surface): Color

Returns the unchecked, focused background Color for an IconToggleButton derived from the provided baseColor.

baseColor is not the final color. It is the unchecked, unfocused background color of the button, which is adjusted so that it is suitable for use as a focused background.

Parameters
baseColor: Color = GlimmerTheme.colors.surface

the unchecked, unfocused background Color of the button, such as Colors.surface or a custom background color

Returns
Color

the background Color for the button when unchecked and focused

focusedCheckedBackgroundColor

Added in 1.0.0-alpha22
@Composable
fun focusedCheckedBackgroundColor(
    baseColor: Color = GlimmerTheme.colors.primary
): Color

Returns the checked, focused background Color for an IconToggleButton derived from the provided baseColor.

baseColor is not the final color. It is the same brand or accent color passed to checkedBackgroundColor, which is adjusted to a tone that is suitable for use as a checked, focused background.

Parameters
baseColor: Color = GlimmerTheme.colors.primary

the brand or accent Color to derive from, such as Colors.primary

Returns
Color

the background Color for the button when checked and focused

shape

Added in 1.0.0-alpha22
@Composable
fun shape(
    checked: Boolean,
    checkedShape: Shape = 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.animatedShape, 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 = 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

CheckedShape

Added in 1.0.0-alpha22
val CheckedShape: Shape

Default shape for IconToggleButton in the checked state.

contentPadding

val contentPadding: PaddingValues

Default content padding used for an IconToggleButton.