Package-level declarations

Buttons help people take action, such as sending an email, sharing a document, or liking a comment. Buttons communicate actions that users can take. They are typically placed throughout your UI, in places like:

  • Dialogs

  • Modal windows

  • Forms

  • Cards

  • Toolbars

Light
Dark

Sizes

The minimal usage of the component is the text and the click action.

ButtonFilled(
text = "Main",
onClick = { /*Click event*/ },
)

The buttons have an loading state that can be used to indicate that the button is loading some data and show/hide an indeterminate circular progress indicator on the start of the button.

All Styles

There are multiple style variants for the button with the same parameters:

ButtonFilled

Filled buttons are the standard button for most use cases. The filled styling places the most emphasis and should be used for important, final actions.

ButtonFilled(
text = "Main",
onClick = { /*Click event*/ },
)

ButtonOutlined

Outlined buttons are used for support actions. The outlined styling places less emphasis on these actions that are important but not the main ones. It is recommended to pair it with a button with more emphasis like the filled button or the tinted button.

Be aware that it's not advised to use it on top of images since it will be hard to see.

ButtonOutlined(
text = "Main",
onClick = { /*Click event*/ },
)

ButtonTinted

Tinted buttons are medium-emphasis buttons that is an alternative middle ground between default Buttons (filled) and Outlined buttons. They can be used in contexts where lower-priority button requires slightly more emphasis than an outline would give, such as "Next" in an onboarding flow.

It's best paired with either a filled button or an outlined button.

ButtonTinted(
text = "Main",
onClick = { /*Click event*/ },
)

ButtonGhost

Ghost buttons are used for the lowest priority actions, especially when presenting multiple options.

Ghost buttons can be placed on a variety of backgrounds. Until the button is interacted with, its container isn’t visible. This button style is often used inside other components like snackbars, dialogs, and cards.

ButtonGhost(
text = "Main",
onClick = { /*Click event*/ },
)

ButtonContrast

Contrast buttons are used for the high to mid priority actions when the background is dark like on an image or a video.

ButtonContrast(
text = "Main",
onClick = { /*Click event*/ },
)

IconButtons take supplementary actions with a single tap. They’re used when a compact button is required, such as in a toolbar or image list.

Styles

Icon buttons come in various styles:

  • Filled

  • Tinted

  • Outlined

  • Contrast

  • Ghost

Light
Dark

Sizes

Icon buttons come in 3 sizes IconButtonSize.kt:

  • small - 32.dp (however, the minimum touch size is applied and is 44.dp)

  • medium - 44.dp (default)

  • large - 56.dp

The content icon is 16.dp for IconButtonSize.Small and IconButtonSize.Medium, and 24.dp for IconButtonSize.Large

Shapes

Icon buttons come in 3 shapes ButtonShape.kt :

  • Square

  • Rounded (default)

  • Pill

The buttons have an loading state that can be used to indicate that the button is loading some data and show/hide an indeterminate circular progress indicator on the start of the button.

Intents

Icon Buttons support all intents:

  • Basic (default)

  • Accent

  • Main

  • Support

  • Success

  • Alert

  • Danger

  • Info

  • Neutral

  • Surface

IconButtonFilled

Filled icon buttons are the standard for most use cases. The filled styling places the most emphasis and should be used for important actions.

fun IconButtonFilled(
icon: SparkIcon,
onClick: () -> Unit,
)

IconButtonOutlined

Outlined icon buttons are used for support actions. The outlined styling places less emphasis on these actions that are important but not the main ones.

Be aware that it's not advised to use it on top of images since it will be hard to see.

fun IconButtonOutlined(
icon: SparkIcon,
onClick: () -> Unit,
)

IconButtonTinted

Tinted icon buttons are medium-emphasis buttons that is an alternative middle ground between default filled icon buttons and outlined icon buttons. They can be used in contexts where lower-priority icon button requires slightly more emphasis than an outline would give.

fun IconButtonTinted(
icon: SparkIcon,
onClick: () -> Unit,
)

IconButtonGhost

Ghost icon buttons are used for the lowest priority actions, especially when presenting multiple options.

Ghost icon buttons can be placed on a variety of backgrounds. Until the button is interacted with, its container isn’t visible. This button style is often used inside other components like snackbars, dialogs, and cards.

fun IconButtonGhost(
icon: SparkIcon,
onClick: () -> Unit,
)

IconButtonContrast

Contrast icon buttons are used for the high to mid priority actions when the background is dark like on an image or a video.

fun IconButtonContrast(
icon: SparkIcon,
onClick: () -> Unit,
)

Types

Link copied to clipboard

ButtonIntent is used to define the intent of the buttons.

Link copied to clipboard
Link copied to clipboard

ButtonSize is used to define the height of the buttons.

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

Functions

Link copied to clipboard
fun ButtonContrast(onClick: () -> Unit, text: AnnotatedString, modifier: Modifier = Modifier, size: ButtonSize = ButtonSize.Medium, intent: ButtonIntent = ButtonIntent.Main, enabled: Boolean = true, icon: SparkIcon? = null, iconSide: IconSide = IconSide.START, isLoading: Boolean = false, interactionSource: MutableInteractionSource = remember { MutableInteractionSource() })
fun ButtonContrast(onClick: () -> Unit, modifier: Modifier = Modifier, size: ButtonSize = ButtonSize.Medium, shape: ButtonShape = SparkButtonDefaults.DefaultShape, intent: ButtonIntent = ButtonIntent.Main, enabled: Boolean = true, icon: SparkIcon? = null, iconSide: IconSide = IconSide.START, isLoading: Boolean = false, interactionSource: MutableInteractionSource = remember { MutableInteractionSource() }, content: @Composable RowScope.() -> Unit)
fun ButtonContrast(onClick: () -> Unit, text: String, modifier: Modifier = Modifier, size: ButtonSize = ButtonSize.Medium, shape: ButtonShape = SparkButtonDefaults.DefaultShape, intent: ButtonIntent = ButtonIntent.Main, enabled: Boolean = true, icon: SparkIcon? = null, iconSide: IconSide = IconSide.START, isLoading: Boolean = false, interactionSource: MutableInteractionSource = remember { MutableInteractionSource() })

Ghost buttons are used for the lowest priority actions, especially when presenting multiple options.

Link copied to clipboard
fun ButtonFilled(onClick: () -> Unit, text: AnnotatedString, modifier: Modifier = Modifier, size: ButtonSize = ButtonSize.Medium, intent: ButtonIntent = ButtonIntent.Main, enabled: Boolean = true, icon: SparkIcon? = null, iconSide: IconSide = IconSide.START, isLoading: Boolean = false, interactionSource: MutableInteractionSource = remember { MutableInteractionSource() })
fun ButtonFilled(onClick: () -> Unit, modifier: Modifier = Modifier, size: ButtonSize = ButtonSize.Medium, shape: ButtonShape = SparkButtonDefaults.DefaultShape, intent: ButtonIntent = ButtonIntent.Main, enabled: Boolean = true, icon: SparkIcon? = null, iconSide: IconSide = IconSide.START, isLoading: Boolean = false, interactionSource: MutableInteractionSource = remember { MutableInteractionSource() }, content: @Composable RowScope.() -> Unit)
fun ButtonFilled(onClick: () -> Unit, text: String, modifier: Modifier = Modifier, size: ButtonSize = ButtonSize.Medium, shape: ButtonShape = SparkButtonDefaults.DefaultShape, intent: ButtonIntent = ButtonIntent.Main, enabled: Boolean = true, icon: SparkIcon? = null, iconSide: IconSide = IconSide.START, isLoading: Boolean = false, interactionSource: MutableInteractionSource = remember { MutableInteractionSource() })

The filled button should only be used once per view (not including a modal dialog), these buttons have the most emphasis.

Link copied to clipboard
fun ButtonGhost(onClick: () -> Unit, modifier: Modifier = Modifier, size: ButtonSize = ButtonSize.Medium, shape: ButtonShape = SparkButtonDefaults.DefaultShape, intent: ButtonIntent = ButtonIntent.Main, enabled: Boolean = true, icon: SparkIcon? = null, iconSide: IconSide = IconSide.START, isLoading: Boolean = false, interactionSource: MutableInteractionSource = remember { MutableInteractionSource() }, content: @Composable RowScope.() -> Unit)
fun ButtonGhost(onClick: () -> Unit, text: AnnotatedString, modifier: Modifier = Modifier, size: ButtonSize = ButtonSize.Medium, shape: ButtonShape = SparkButtonDefaults.DefaultShape, intent: ButtonIntent = ButtonIntent.Main, enabled: Boolean = true, icon: SparkIcon? = null, iconSide: IconSide = IconSide.START, isLoading: Boolean = false, interactionSource: MutableInteractionSource = remember { MutableInteractionSource() })
fun ButtonGhost(onClick: () -> Unit, text: String, modifier: Modifier = Modifier, size: ButtonSize = ButtonSize.Medium, shape: ButtonShape = SparkButtonDefaults.DefaultShape, intent: ButtonIntent = ButtonIntent.Main, enabled: Boolean = true, icon: SparkIcon? = null, iconSide: IconSide = IconSide.START, isLoading: Boolean = false, interactionSource: MutableInteractionSource = remember { MutableInteractionSource() })

The ghost button is the button for non important actions. The mandatory icon help to indicate that it's a clickable text

Link copied to clipboard
fun ButtonOutlined(onClick: () -> Unit, text: AnnotatedString, modifier: Modifier = Modifier, size: ButtonSize = ButtonSize.Medium, intent: ButtonIntent = ButtonIntent.Support, enabled: Boolean = true, icon: SparkIcon? = null, iconSide: IconSide = IconSide.START, isLoading: Boolean = false, interactionSource: MutableInteractionSource = remember { MutableInteractionSource() })
fun ButtonOutlined(onClick: () -> Unit, text: String, modifier: Modifier = Modifier, size: ButtonSize = ButtonSize.Medium, shape: ButtonShape = SparkButtonDefaults.DefaultShape, intent: ButtonIntent = ButtonIntent.Support, enabled: Boolean = true, icon: SparkIcon? = null, iconSide: IconSide = IconSide.START, isLoading: Boolean = false, interactionSource: MutableInteractionSource = remember { MutableInteractionSource() })

Outlined buttons are used for support actions. The outlined styling places less emphasis on these actions that are important but not the main ones. It is recommended to pair it with a button wit more emphasis like the filled button or the tinted button.

fun ButtonOutlined(onClick: () -> Unit, modifier: Modifier = Modifier, size: ButtonSize = ButtonSize.Medium, shape: ButtonShape = SparkButtonDefaults.DefaultShape, intent: ButtonIntent = ButtonIntent.Support, enabled: Boolean = true, icon: SparkIcon? = null, iconSide: IconSide = IconSide.START, isLoading: Boolean = false, interactionSource: MutableInteractionSource = remember { MutableInteractionSource() }, content: @Composable RowScope.() -> Unit)

Outlined buttons are used for support actions. The outlined styling places less emphasis on these actions that are ` important but not the main ones. It is recommended to pair it with a button wit more emphasis like the filled button or the tinted button.

Link copied to clipboard
fun ButtonTinted(onClick: () -> Unit, modifier: Modifier = Modifier, size: ButtonSize = ButtonSize.Medium, shape: ButtonShape = SparkButtonDefaults.DefaultShape, intent: ButtonIntent = ButtonIntent.Main, enabled: Boolean = true, icon: SparkIcon? = null, iconSide: IconSide = IconSide.START, isLoading: Boolean = false, interactionSource: MutableInteractionSource = remember { MutableInteractionSource() }, content: @Composable RowScope.() -> Unit)
fun ButtonTinted(onClick: () -> Unit, text: AnnotatedString, modifier: Modifier = Modifier, size: ButtonSize = ButtonSize.Medium, shape: ButtonShape = SparkButtonDefaults.DefaultShape, intent: ButtonIntent = ButtonIntent.Main, enabled: Boolean = true, icon: SparkIcon? = null, iconSide: IconSide = IconSide.START, isLoading: Boolean = false, interactionSource: MutableInteractionSource = remember { MutableInteractionSource() })
fun ButtonTinted(onClick: () -> Unit, text: String, modifier: Modifier = Modifier, size: ButtonSize = ButtonSize.Medium, shape: ButtonShape = SparkButtonDefaults.DefaultShape, intent: ButtonIntent = ButtonIntent.Main, enabled: Boolean = true, icon: SparkIcon? = null, iconSide: IconSide = IconSide.START, isLoading: Boolean = false, interactionSource: MutableInteractionSource = remember { MutableInteractionSource() })

Tinted buttons are medium-emphasis buttons that is an alternative middle ground between default Buttons (filled) and Outlined buttons. They can be used in contexts where lower-priority button requires slightly more emphasis than an outline would give, such as "Next" in an onboarding flow.

Link copied to clipboard
fun ExtendedFloatingActionButton(onClick: () -> Unit, modifier: Modifier = Modifier, shape: Shape = FloatingActionButtonDefaults.extendedFabShape, containerColor: Color = FloatingActionButtonDefaults.containerColor, contentColor: Color = contentColorFor(containerColor), elevation: FloatingActionButtonElevation = FloatingActionButtonDefaults.elevation(), interactionSource: MutableInteractionSource = remember { MutableInteractionSource() }, content: @Composable RowScope.() -> Unit)
fun ExtendedFloatingActionButton(text: @Composable () -> Unit, icon: SparkIcon, onClick: () -> Unit, modifier: Modifier = Modifier, expanded: Boolean = true, shape: Shape = FloatingActionButtonDefaults.extendedFabShape, containerColor: Color = FloatingActionButtonDefaults.containerColor, contentColor: Color = contentColorFor(containerColor), elevation: FloatingActionButtonElevation = FloatingActionButtonDefaults.elevation(), interactionSource: MutableInteractionSource = remember { MutableInteractionSource() })
Link copied to clipboard
fun FloatingActionButton(onClick: () -> Unit, icon: SparkIcon, contentDescription: String?, modifier: Modifier = Modifier, shape: Shape = FloatingActionButtonDefaults.shape, containerColor: Color = FloatingActionButtonDefaults.containerColor, contentColor: Color = contentColorFor(containerColor), elevation: FloatingActionButtonElevation = FloatingActionButtonDefaults.elevation(), interactionSource: MutableInteractionSource = remember { MutableInteractionSource() })
Link copied to clipboard
fun LargeFloatingActionButton(onClick: () -> Unit, icon: SparkIcon, contentDescription: String?, modifier: Modifier = Modifier, shape: Shape = FloatingActionButtonDefaults.largeShape, containerColor: Color = FloatingActionButtonDefaults.containerColor, contentColor: Color = contentColorFor(containerColor), elevation: FloatingActionButtonElevation = FloatingActionButtonDefaults.elevation(), interactionSource: MutableInteractionSource = remember { MutableInteractionSource() })
Link copied to clipboard
fun SmallFloatingActionButton(onClick: () -> Unit, icon: SparkIcon, contentDescription: String?, modifier: Modifier = Modifier, shape: Shape = FloatingActionButtonDefaults.smallShape, containerColor: Color = FloatingActionButtonDefaults.containerColor, contentColor: Color = contentColorFor(containerColor), elevation: FloatingActionButtonElevation = FloatingActionButtonDefaults.elevation(), interactionSource: MutableInteractionSource = remember { MutableInteractionSource() })