Message
A user bubble or an assistant message with host-rendered content.
A user bubble or an assistant message with host-rendered content.
The widgets live in experimental package:remix/agent.dart, outside Remix's stability promise.
Import it explicitly; package:remix/remix.dart does not export it.
The registry installs editable preset recipes and their dependencies into your app.
Widget, model, and styler names keep the Agent prefix. Recipe names use your app's prefix.
Install
For a new app, initialize one preset, then add the recipe and glyphs:
remix init --prefix Ui --preset fortal
remix add message_recipe agent_glyphs_recipeExisting apps keep their chosen preset. Vanilla and HeroUI provide the same recipe roles.
No consumer build.yaml is needed for these Agent recipes.
Behavior
Pass the author through role and the content through child.
User messages align to the end; other roles align to the start.
The preset controls the surface, width, and collapsed height.
Long user messages offer Show more and Show less when the style sets a collapsed height.
Use expanded with onExpandedChanged for controlled expansion, or defaultExpanded for its initial state.
header and footer accept application widgets.
Use the recipe
This example assumes prefix Ui and the installed UiTheme above the widget.
Wrap the conversation in AgentGlyphs(builder: uiAgentGlyph, child: ...) to draw preset glyphs.
import 'package:flutter/widgets.dart';
import 'package:remix/agent.dart';
import 'ui/ui.dart';
Widget buildMessage() {
final recipe = uiAgentMessageRecipe();
return AgentMessage(
role: AgentRole.user,
style: recipe.style,
toggleStyle: recipe.toggleStyle,
child: const Text('Review the checkout flow.'),
);
}The recipe returns these unresolved styles. Pass each into its matching widget parameter; child controls resolve hover, focus, and disabled state in their own context.
| Bundle field | Style type |
|---|---|
style | AgentMessageStyler |
toggleStyle | ButtonStyler |
Each factory merges same-named overrides after its preset defaults.
Edit the installed recipe to customize it. remix add message_recipe --diff previews upstream differences.
See migration for the previous registry API.