Skip to content

Banner ​

An inline status banner. A tinted background and tone-colored leading icon carry the tone; it pairs a bold title with a quieter message, plus an optional action and close (×). Danger announces assertively to assistive tech.

Import ​

kotlin
import io.github.heartcoolman.prism.ui.PrismBanner

Basic usage ​

kotlin
PrismBanner(
    title = "Heads up",
    message = "Your changes have been saved.",
)

Tones ​

tone drives the tint and the default leading icon (Success → check, Warning/Danger → warning, others → info).

kotlin
PrismBanner(title = "All set", tone = PrismTone.Success)
PrismBanner(title = "Check your input", tone = PrismTone.Warning)
PrismBanner(title = "Upload failed", message = "Try again.", tone = PrismTone.Danger)

Action and close ​

kotlin
PrismBanner(
    title = "Update available",
    message = "A new version is ready to install.",
    tone = PrismTone.Accent,
    onClose = { /* dismiss */ },
    action = { PrismButton(onClick = {}) { Text("Update") } },
)

API ​

ParameterTypeDefaultDescription
titleString—Bold leading line.
modifierModifierModifierLayout/visual modifier.
messageString?nullSecondary descriptive text.
tonePrismTonePrismTone.AccentSemantic tone driving tint, icon color, and live-region urgency.
iconImageVector?nullLeading glyph; falls back to a tone-default icon.
onClose(() -> Unit)?nullWhen set, renders a trailing close (×) button.
action(@Composable RowScope.() -> Unit)?nullTrailing action slot (e.g. a button).

Enum ​

kotlin
enum class PrismTone { Accent, Success, Warning, Danger, Neutral }

All components assume an enclosing PrismTheme { }. See Styling for theming details.

Released under the MIT License.