diff --git a/src/Core/Components/Button/FluentButton.razor b/src/Core/Components/Button/FluentButton.razor
index 93bc76c058..f409beb2eb 100644
--- a/src/Core/Components/Button/FluentButton.razor
+++ b/src/Core/Components/Button/FluentButton.razor
@@ -27,6 +27,7 @@
title="@Title"
appearance="@(Appearance == ButtonAppearance.Default ? null : Appearance.ToAttributeValue())"
@onclick="@OnClickHandlerAsync"
+ @onclick:stopPropagation="@StopPropagation"
@attributes="AdditionalAttributes">
@if (IconStart != null)
{
diff --git a/src/Core/Components/Button/FluentButton.razor.cs b/src/Core/Components/Button/FluentButton.razor.cs
index 9b9a07a990..9a61428c15 100644
--- a/src/Core/Components/Button/FluentButton.razor.cs
+++ b/src/Core/Components/Button/FluentButton.razor.cs
@@ -174,6 +174,12 @@ public partial class FluentButton : FluentComponentBase
[Parameter]
public string? Title { get; set; }
+ ///
+ /// Gets or sets a way to prevent further propagation of the current event in the capturing and bubbling phases.
+ ///
+ [Parameter]
+ public bool StopPropagation { get; set; } = false;
+
///
/// Gets or sets the content to be rendered inside the component.
///
diff --git a/tests/Core/Components/Button/FluentButtonTests.razor b/tests/Core/Components/Button/FluentButtonTests.razor
index 9152cb0338..63f175d448 100644
--- a/tests/Core/Components/Button/FluentButtonTests.razor
+++ b/tests/Core/Components/Button/FluentButtonTests.razor
@@ -392,4 +392,48 @@
// Assert
cut.Verify();
}
+
+ [Fact]
+ public void FluentButton_StopPropagationFalse()
+ {
+ bool clickedondiv = false;
+ bool clicked = false;
+
+ // Arrange
+ // Not adding StopPropagation here explicitly because it is false by default
+ var cut = Render(@
{clickedondiv = true; })">
+
+ My button
+
+
);
+
+ // Act
+ cut.Find("fluent-button").Click();
+
+ // Assert
+ Assert.True(clickedondiv);
+ Assert.True(clicked);
+ }
+
+ [Fact]
+ public void FluentButton_StopPropagationTrue()
+ {
+ bool clickedondiv = false;
+ bool clicked = false;
+
+ // Arrange
+ var cut = Render(@ {clickedondiv = true; })">
+
+ My button
+
+
);
+
+ // Act
+ cut.Find("fluent-button").Click();
+
+ // Assert
+ Assert.False(clickedondiv);
+ Assert.True(clicked);
+ }
+}
}