diff --git a/src/Components/Web/src/Web/RenderTreeBuilderExtensions.cs b/src/Components/Web/src/Web/RenderTreeBuilderExtensions.cs
new file mode 100644
index 0000000000..89dbc5684b
--- /dev/null
+++ b/src/Components/Web/src/Web/RenderTreeBuilderExtensions.cs
@@ -0,0 +1,53 @@
+// Copyright (c) .NET Foundation. All rights reserved.
+// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
+
+using Microsoft.AspNetCore.Components.Rendering;
+using Microsoft.AspNetCore.Components.RenderTree;
+
+namespace Microsoft.AspNetCore.Components.Web
+{
+ ///
+ /// Provides methods for building a collection of entries.
+ ///
+ public static class RenderTreeBuilderExtensions
+ {
+ // The "prevent default" and "stop bubbling" flags behave like attributes, in that:
+ // - you can have multiple of them on a given element (for separate events)
+ // - you can add and remove them dynamically
+ // - they are independent of other attributes (e.g., you can "stop bubbling" of a given
+ // event type on an element that doesn't itself have a handler for that event)
+ // As such, they are represented as attributes to give the right diffing behavior.
+ //
+ // As a private implementation detail, their internal representation is magic-named
+ // attributes. This may change in the future. If we add support for multiple-same
+ // -named-attributes-per-element (#14365), then we will probably also declare a new
+ // AttributeType concept, and have specific attribute types for these flags, and
+ // the "name" can simply be the name of the event being modified.
+
+ ///
+ /// Appends a frame representing an instruction to prevent the default action
+ /// for a specified event.
+ ///
+ /// The .
+ /// An integer that represents the position of the instruction in the source code.
+ /// The name of the event to be affected.
+ /// True if the default action is to be prevented, otherwise false.
+ public static void AddEventPreventDefaultAttribute(this RenderTreeBuilder builder, int sequence, string eventName, bool value)
+ {
+ builder.AddAttribute(sequence, $"__internal_preventDefault_{eventName}", value);
+ }
+
+ ///
+ /// Appends a frame representing an instruction to stop the specified event from
+ /// bubbling up beyond the current element.
+ ///
+ /// The .
+ /// An integer that represents the position of the instruction in the source code.
+ /// The name of the event to be affected.
+ /// True if bubbling should stop bubbling here, otherwise false.
+ public static void AddEventStopBubblingAttribute(this RenderTreeBuilder builder, int sequence, string eventName, bool value)
+ {
+ builder.AddAttribute(sequence, $"__internal_stopBubbling_{eventName}", value);
+ }
+ }
+}