Feedback

SKSnackbar

SKSnackbar exposes a host and a controller so messages queue instead of overwriting each other. Duration, action and severity are part of the message contract.

Betasince 1.6.0Compose · XMLAll components

Not yet released. SKSnackbar is planned for 1.6.0; the current published release (1.4.0-alpha01) ships SKText and SKTextField only.

Usage

SKSnackbar.kt
val host = rememberSKSnackbarHost()

host.show(
    SKSnackbarMessage(
        text = "Draft saved",
        severity = SKSeverity.Success,
        action = SKAction("Undo", onClick = ::undo)
    )
)

Props

PropTypeDefaultDescription
textString—Message body.
severitySKSeverityInfoInfo, Success, Warning or Error.
actionSKAction?nullOptional action.

Accessibility

Messages are announced politely; action has an independent accessible label; duration extends under TalkBack.

Theming

Severity colours map to info, success, warning and error roles.

API surface

  • SKSnackbar
  • SKSnackbarHost
  • SKSnackbarMessage
  • SKSeverity

Related