ProvideMaterial3Agui

fun ProvideMaterial3Agui(textRenderer: AguiTextRenderer = Material3AguiTextRenderer, components: AguiComponents = Material3AguiComponents(), content: @Composable () -> Unit)

Provides both of this module's defaults to everything drawn inside.

Two composition locals, not one, and that is the point of the function existing. Providing Material3AguiComponents alone leaves LocalAguiTextRenderer at PlainAguiTextRenderer, which draws through BasicText and therefore has no ambient text style -- so a transcript would have Material 3 tool calls and bubbles around prose that ignored the theme's type scale and content colour entirely. The two defaults are one decision and this is the call that makes it.

MaterialTheme {
Surface {
ProvideMaterial3Agui {
AguiTranscript(transcript)
}
}
}

A MaterialTheme above it is the caller's job rather than this function's. Wrapping one here would mean a nested theme inside every application that already has its own -- and quietly discarding that application's colour scheme, which is the one thing a design-system layer must not do.

The Surface is the caller's job for a weaker reason but a sharper one. MaterialTheme does not provide LocalContentColor; it is left at Material 3's default of black until a Surface derives it from the background it paints. So a dark theme with no Surface above this call draws black prose on a dark ground -- which is the failure Material3AguiTextRenderer exists to prevent, arriving from the one direction this module cannot reach. Most applications already have a Scaffold or a Surface and never see it; the snippet above carries one so that the shortest path through this API is not the broken one.

Parameters

textRenderer

the seam a Markdown implementation is fitted through. Pass one and the slots in this module keep working: prose draws through whatever is provided here, framed by Material 3 either way. remember it -- the local is static, so a renderer rebuilt on every recomposition re-renders the whole transcript on every frame of a streaming response.

components

the slot table, for a caller who has copy-ed a slot of it.