protected override void ComposeTree(TreeComposer composer) { composer.Element( name: "text-display", capture: element => this.textDisplayRef = element, styles: new Dictionary <string, string> { { "background-color", this.backgroundColor } }, attributes: new Dictionary <string, string> { { "tabindex", "0" }, // required to receive focus }, events: new TreeComposer.Events { OnKeyDownAsync = args => this.AcceptInput(args.Key) }, body: () => { if (!string.IsNullOrEmpty(this.Title)) { composer.Element( name: "title", body: () => composer.Text(this.Title)); } foreach (var chunk in this.outputChunks) { composer.Element( name: "span", body: () => composer.Text(chunk.Text), styles: new Dictionary <string, string> { { "color", chunk.HexColor } }); if (chunk.AppendNewLine) { composer.Element("br"); } } composer.Element("input-field", capture: element => this.inputFieldRef = element, body: () => { if (this.mode != AcceptedInputMode.None) { composer.Element("span", body: () => composer.Text(this.inputBuffer)); composer.Element(name: "span", body: () => { composer.Element("cursor", body: () => { composer.Markup("█"); }); }); } }); }); }