public object IconToggleButtonDefaults
Contains default values used by IconToggleButtons.
Properties
contentPadding
public val contentPadding: PaddingValues
Default content padding used for an IconToggleButton.
CheckedShape
public val CheckedShape: Shape = ToggleButtonDefaults.CheckedShape
Default shape for IconToggleButton in the checked state.
Functions
shape
@Composable
public 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 | whether the button is in the checked state |
| checkedShape | the shape of the button when it is checked |
| uncheckedShape | the shape of the button when it is unchecked |
animatedShape
@Composable
public 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 | whether the button is in the checked state |
colors
@Composable
public 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 | the background color when the button is unchecked and unfocused |
| focusedBackgroundColor | the background color when the button is unchecked and focused |
| checkedBackgroundColor | the background color when the button is checked and unfocused |
| focusedCheckedBackgroundColor | the background color when the button is checked and focused. Defaults to a color derived from checkedBackgroundColor |
| contentColor | the content color when the button is unchecked and unfocused |
| focusedContentColor | the content color when the button is unchecked and focused |
| checkedContentColor | the content color when the button is checked and unfocused |
| focusedCheckedContentColor | the content color when the button is checked and focused |
focusedBackgroundColor
@Composable
public 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 | the unchecked, unfocused background Color of the button, such as Colors.surface or a custom background color |
Return
the background Color for the button when unchecked and focused
checkedBackgroundColor
@Composable
public 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 | the brand or accent Color to derive from, such as Colors.primary |
Return
the background Color for the button when checked and unfocused
focusedCheckedBackgroundColor
@Composable
public 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 | the brand or accent Color to derive from, such as Colors.primary |
Return
the background Color for the button when checked and focused