namespace Htmx.ApiDemo.Templates.Components; /// /// Fixed viewport container for toast notifications. /// Place once in the page (or layout). Toasts appear via window.showToast() from components.js. /// public sealed class ToastViewport : ToastViewportBase { private readonly byte[] _idData; private readonly byte[] _toastsData; public ToastViewport(string id = "toast-viewport") { _idData = id.ToUtf8Bytes(); _toastsData = []; } protected override void RenderId(HtmxRenderContext ctx) => ctx.Writer.WriteUtf8(_idData); protected override void RenderToasts(HtmxRenderContext ctx) => ctx.Writer.WriteUtf8(_toastsData); }