Skip to main content

CamoBanner

Concept​

1. Why​

A banner is an inline message that stays in the layout until it's resolved: "Your trial ends in 3 days · Upgrade", "Couldn't sync · Retry", a form-level error summary. Fluent calls it MessageBar, and Carbon inline notification. Material dropped banners in M3, but apps still need them. Unlike a snackbar, it's placed in the page, not shown. It's the clearest showcase of Tone.

2. Shape​

Material mapping preview: there's no M3 component. The Material skin draws it like a Soft card:

  • the tone's container color and a default status icon per tone (info ⓘ, success ✓, warning ⚠, error ⨯);
  • actions as Ghost buttons in the tone's strong color;
  • shapes.medium.

3. API​

Contract​

fun CamoBanner(
message: String,
tone: Tone = Info,
title: String? = null,
icon: Widget? = null, // null → the skin's default icon for the tone; pass an empty widget for none
actions: List<Widget> = emptyList(), // usually CamoButtons (appearance = Ghost)
onDismiss: (() -> Unit)? = null, // non-null → a ✕ button
appearance: Appearance? = null, // null → BannerTheme.defaultAppearance (skin default: Soft); Soft | Solid | Outline
)

State → renderer: BannerState(title?, message, tone, appearance, dismissible). Slots: BannerSlots(icon?, actions, dismiss?).

Tokens used​

  • the tone family (container, on-container, strong)
  • typography.titleSmall (title), bodyMedium (message)
  • shapes.medium, spacing.l padding

Component theme​

theme.components.banner: BannerTheme?. Every field is nullable in the theme. The skin's defaults(theme) fills whatever isn't set (Material defaults shown). See Theme §3.10.

FieldTypeMaterial defaultWhat it's for
defaultAppearanceAppearanceSoftthe appearance used when a call passes none (ADR-28: a brand's default variant)
shapeShapeshapes.mediumcorners
paddingPadding16inner padding
titleStyle / messageStyleCamoTextStyletitleSmall / bodyMediumtexts
iconSizeDp24status icon
accentBorderBooleanfalsea start border in the tone's strong color (Carbon style)
toneIconsToneIcons(info, success, warning, error: IconSource)the skin's iconsthe default status icons, so a brand can use its own icon set (ADR-28). CamoSnackbar uses the same icons when showToneIcon is on.

Accessibility​

  • Role status (Info/Success), or alert (Warning/Error) when the banner appears after the page loaded, so it's announced. A banner present from the start isn't announced; it's read in order.
  • Tone must not be conveyed by color alone: the default icon and the title/message carry it too (WCAG 1.4.1).
  • The ✕ is a CamoIconButton labelled "Dismiss".

4. Build steps​

  1. CamoBanner, BannerRenderer (default icons per tone), and the DebugSkin renderer.
  2. Sample: the four tones, with and without title, actions and dismiss. A form-error summary above a CamoForm.
  3. Tests: an alert role for errors that appear later; the dismiss button; the default icon per tone.

Done when

  • All four tones in three appearances render in light and dark, and are announced correctly.

5. Edge cases​

CaseDecided behavior
Long messages at 200%The text wraps, and the actions move below the text.
Many actionsUp to two recommended. More wrap to a second row.
Sticky banners (top of the screen, global)App layout: place the banner above the content in the page. It's not an overlay.
Changed in the M7 build (2026-10-28)
  • BannerTheme gains accentWidth, borderWidth (the Outline appearance), dismissIcon and strings; toneIcons is a ToneIcons(info, success, warning, error) with ofTone(tone), shared with the snackbar.
  • BannerStyle.colorsFor(appearance, tone, theme) returns BannerColors(container, content, accent, border?): Soft the tone's container, Solid its strong fill, Outline the surface with a tone border.
  • Ghost and Link buttons among the actions take the accent the renderer provides around them (core overrides their colors in a nested provider), so a Retry on a Solid error banner is readable. Apps pass plain Ghost buttons, no tone.
  • The ✕ is a field action, its own accessibility node; the texts and icon read as one node.
  • Fluent's MessageBar draws a light intent border.

Implementation​

1. Why​

An inline message with a tone, an optional title, actions and a dismiss button. Kotlin's specifics: the actions wrap below the text when space runs out (FlowRow), and a banner that appears later (a sync error) is announced with a live region.

2. Shape​

3. API​

@Composable
public fun CamoBanner(
message: String,
modifier: Modifier = Modifier,
tone: Tone = Tone.Info,
title: String? = null,
icon: (@Composable () -> Unit)? = null, // null → BannerTheme.toneIcons for the tone
actions: @Composable RowScope.() -> Unit = {},
onDismiss: (() -> Unit)? = null,
appearance: Appearance? = null,
)
  • Icon: style.toneIcons gives an IconSource per tone, drawn with CamoIcon; passing icon = {} shows none.
  • Actions: laid out in a FlowRow below the texts; at wide widths the renderer may place them at the end of the row (a skin choice). Buttons inherit the tone's content color through ProvideContentStyle.
  • Semantics: the banner merges its texts; for Tone.Error / Tone.Warning it sets liveRegion = LiveRegionMode.Polite so a banner inserted after first composition is read. The dismiss button is CamoIconButton(contentDescription = "Dismiss").
  • Accent border: style.accentBorder draws a start-edge bar with drawBehind, mirrored in RTL.

4. Build steps​

  1. BannerTheme / Style (with toneIcons), CamoBanner, the DebugSkin renderer.
  2. commonTest: default icon per tone; icon = {} hides it; actions wrap at 200% font scale; the live region on a late Error banner; dismiss calls back.

Done when

  • Trial, sync-error and form-summary banners render in each tone and appearance, and a late error banner is announced.

5. Edge cases​

CaseDecided behavior
Banner shown from the first frameNot announced as an alert (it's part of the page); it's read in reading order.
Many actionsWrap to more rows; guidance stays two.
Changed in the M7 build (2026-10-28)
  • actions: (@Composable RowScope.() -> Unit)?; Minimal and Fluent lay them out in a FlowRow below the texts.