Composer
A growing prompt field with host actions and Send or Stop.
A growing prompt field with host actions and Send or Stop.
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 composer_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
Share an AgentComposerController with suggestions or other host controls.
Set controller.running while work is active. Wire onSubmit to your runner and onStop to cancellation.
The field grows to the recipe's maximum height and then scrolls.
Enter submits, Shift+Enter inserts a newline, and active IME composition does not submit.
A surface tap focuses the field. The surface resolves focused styling while the field has focus.
leading and trailing accept host-owned toolbar widgets.
The field needs an Overlay when focused for selection handles.
A routed WidgetsApp, MaterialApp, or CupertinoApp supplies one;
with a bare WidgetsApp(builder: ...), wrap the composer subtree in Overlay.wrap.
Dispose controllers and focus nodes that your host creates.
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 buildComposer(
AgentComposerController controller,
void Function(String) onSubmit,
) {
final recipe = uiAgentComposerRecipe();
return AgentComposer(
controller: controller,
onSubmit: onSubmit,
style: recipe.style,
fieldStyle: recipe.fieldStyle,
submitStyle: recipe.submitStyle,
stopStyle: recipe.stopStyle,
);
}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 | AgentComposerStyler |
fieldStyle | TextFieldStyler |
submitStyle | IconButtonStyler |
stopStyle | IconButtonStyler |
Each factory merges same-named overrides after its preset defaults.
Edit the installed recipe to customize it. remix add composer_recipe --diff previews upstream differences.
See migration for the previous registry API.