When typing a message in ChatClientChat, pressing Shift+Enter does not insert a new line. The message field behaves as a single-line input instead of allowing multiple lines.
Cause
The AutoGrow property no longer exists as of MudBlazor 9.0.0, which replaced it with InputSizing.Auto.
Symptom
AutoGrowis ignored as a parameter and ends up as a plain HTML attribute (autogrow="").- The field renders as a single-line
input, not as atextarea.
2 Answer(s)
-
0
In ABP v10.7, the AI Management MudBlazor chat widget (
ChatClientChat) ultimately relies on a MudBlazor text input for composing the message. In MudBlazor v9,AutoGrowis removed, and if the input is not explicitly configured to be multi-line, MudBlazor will render a single-line<input>(so Shift+Enter can’t insert a newline, because there is no<textarea>).Fix: ensure the message composer is rendered as a textarea by configuring it as multi-line. In MudBlazor, the reliable way is to set
Lines(or equivalent multi-line setting) on the underlyingMudTextFieldused for the message input.- If you are using the ABP-provided
ChatClientChatas-is and can’t change its internal markup, the only definitive fix is to override/replace the component (copy source into your project) and update the message field to be multi-line (i.e.,Lines="X"so it becomes a<textarea>). After that, Shift+Enter will work normally (and Enter handling can still be kept for “send” logic).
- If you are using the ABP-provided
Notes for MudBlazor v9 migration:
- Don’t use
AutoGrowanymore (it becomes a strayautogrow=""attribute, exactly as you observed). InputSizing.Autois about sizing behavior; it does not automatically convert a single-line input to a textarea. You still must configure the field as multi-line.
- Don’t use
Minimal example of what the message editor should look like inside the chat component (the key part is
Lines="3"; increase as needed):
<MudTextField @bind-Value="_message" Lines="3" Placeholder="Type a message..." Immediate="true" />Sources:
- https://abp.io/docs/10.7/modules/ai-management/
- https://abp.io/docs/10.7/framework/ui/blazor/forms-validation?BlazorUI=MudBlazor
This response was generated by AI. If it didn’t solve your problem, feel free to post a new answer — our support team will jump in to help you soon.
Markdown supported.Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post) -
0
Hi,
ChatClientChatstill usesAutoGrow, which was removed in MudBlazor 9. That's why the field renders as a single-line input.You can use this workaround for now. It maps the old
AutoGrowattribute toSizing="InputSizing.Auto". Add this class to yourBlazor.Clientproject:using System.Threading.Tasks; using Microsoft.AspNetCore.Components; using MudBlazor; namespace YourProjectName.Blazor.Client.Components; public class AutoGrowMudTextField : MudTextField<string> { public override Task SetParametersAsync(ParameterView parameters) { if (parameters.TryGetValue<object>("AutoGrow", out var autoGrow)) { Sizing = autoGrow is true or "true" ? InputSizing.Auto : InputSizing.Fixed; } return base.SetParametersAsync(parameters); } }Then register it in the
ConfigureServicesmethod of both yourBlazorandBlazor.Clientproject modules:using YourProjectName.Blazor.Client.Components; context.Services.AddTransient<global::MudBlazor.MudTextField<string>, AutoGrowMudTextField>();Only text fields that still set
AutoGrowto true are changed. You can remove this after upgrading to the version that includes the fix.We'll fix this in the next patch release. Your ticket has been refunded.
Thanks
Markdown supported.Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)