diff --git a/examples/Demo/Shared/Microsoft.FluentUI.AspNetCore.Components.xml b/examples/Demo/Shared/Microsoft.FluentUI.AspNetCore.Components.xml
index cb5d5a5110..efd8158017 100644
--- a/examples/Demo/Shared/Microsoft.FluentUI.AspNetCore.Components.xml
+++ b/examples/Demo/Shared/Microsoft.FluentUI.AspNetCore.Components.xml
@@ -3198,6 +3198,11 @@
Gets or sets a value indicating whether the tooltip is visible.
+
+
+ Gets or sets a collection of additional attributes that will be applied to the created element.
+
+
diff --git a/examples/Demo/Shared/Pages/Tooltip/Examples/TooltipDefault.razor b/examples/Demo/Shared/Pages/Tooltip/Examples/TooltipDefault.razor
index 9571388a92..434edc469b 100644
--- a/examples/Demo/Shared/Pages/Tooltip/Examples/TooltipDefault.razor
+++ b/examples/Demo/Shared/Pages/Tooltip/Examples/TooltipDefault.razor
@@ -2,7 +2,7 @@
Hello World
- It is a small tootip.
+ It is a small tooltip.
@code {
@@ -10,4 +10,4 @@
{
DemoLogger.WriteLine("Tooltip dismissed!");
}
-}
\ No newline at end of file
+}
diff --git a/src/Core/Components/Tooltip/FluentTooltip.razor b/src/Core/Components/Tooltip/FluentTooltip.razor
index a366306d67..6e35151182 100644
--- a/src/Core/Components/Tooltip/FluentTooltip.razor
+++ b/src/Core/Components/Tooltip/FluentTooltip.razor
@@ -15,7 +15,7 @@
vertical-viewport-lock="@VerticalViewportLock"
role="tooltip"
@ontooltipdismiss="HandleDismissed"
- @attributes="AdditionalAttributes">
+ @attributes="@AdditionalAttributes">
@if (string.IsNullOrWhiteSpace(MaxWidth ?? GlobalOptions?.MaxWidth))
{
@ChildContent
diff --git a/src/Core/Components/Tooltip/FluentTooltip.razor.cs b/src/Core/Components/Tooltip/FluentTooltip.razor.cs
index 93ddb78d39..c4e79fd0d9 100644
--- a/src/Core/Components/Tooltip/FluentTooltip.razor.cs
+++ b/src/Core/Components/Tooltip/FluentTooltip.razor.cs
@@ -1,3 +1,7 @@
+// ------------------------------------------------------------------------
+// MIT License - Copyright (c) Microsoft Corporation. All rights reserved.
+// ------------------------------------------------------------------------
+
using Microsoft.AspNetCore.Components;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.FluentUI.AspNetCore.Components.Components.Tooltip;
@@ -69,7 +73,7 @@ public partial class FluentTooltip : FluentComponentBase, IDisposable
public string Anchor { get; set; } = string.Empty;
///
- /// Gets or sets the delay (in milliseconds).
+ /// Gets or sets the delay (in milliseconds).
/// Default is 300.
///
[Parameter]
@@ -116,7 +120,7 @@ public partial class FluentTooltip : FluentComponentBase, IDisposable
///
/// Callback for when the tooltip is dismissed.
- ///
+ ///
[Parameter]
public EventCallback OnDismissed { get; set; }
@@ -136,7 +140,7 @@ private void HandleDismissed()
///
protected override void OnInitialized()
{
- HideTooltipOnCursorLeave = HideTooltipOnCursorLeave ?? LibraryConfiguration?.HideTooltipOnCursorLeave;
+ HideTooltipOnCursorLeave ??= LibraryConfiguration?.HideTooltipOnCursorLeave;
_tooltipService = ServiceProvider?.GetService();
if (TooltipService != null && UseTooltipService)
@@ -151,6 +155,7 @@ protected override void OnInitialized()
Position = Position,
OnDismissed = OnDismissed,
Visible = Visible,
+ AdditionalAttributes = AdditionalAttributes,
});
}
}
diff --git a/src/Core/Components/Tooltip/FluentTooltipProvider.razor b/src/Core/Components/Tooltip/FluentTooltipProvider.razor
index 2a65eabebe..bb8152ecb4 100644
--- a/src/Core/Components/Tooltip/FluentTooltipProvider.razor
+++ b/src/Core/Components/Tooltip/FluentTooltipProvider.razor
@@ -12,7 +12,10 @@
Delay="@item.Delay"
Position="@item.Position"
OnDismissed="@item.OnDismissed"
- UseTooltipService="false">@item.ChildContent
+ UseTooltipService="false"
+ AdditionalAttributes="@item.AdditionalAttributes">
+ @item.ChildContent
+
}
}
diff --git a/src/Core/Components/Tooltip/Services/TooltipOptions.cs b/src/Core/Components/Tooltip/Services/TooltipOptions.cs
index 91a4e2a74c..526fbe5a2c 100644
--- a/src/Core/Components/Tooltip/Services/TooltipOptions.cs
+++ b/src/Core/Components/Tooltip/Services/TooltipOptions.cs
@@ -1,3 +1,7 @@
+// ------------------------------------------------------------------------
+// MIT License - Copyright (c) Microsoft Corporation. All rights reserved.
+// ------------------------------------------------------------------------
+
using Microsoft.AspNetCore.Components;
namespace Microsoft.FluentUI.AspNetCore.Components.Components.Tooltip;
@@ -31,24 +35,25 @@ public class TooltipOptions
/// Gets or sets the delay (in milliseconds).
/// Default is 300.
///
- [Parameter]
public int? Delay { get; set; } = TooltipGlobalOptions.DefaultDelay;
///
/// Gets or sets the tooltip's position. See .
///
- [Parameter]
public TooltipPosition? Position { get; set; }
///
/// Callback for when the tooltip is dismissed.
///
- [Parameter]
public EventCallback OnDismissed { get; set; }
///
/// Gets or sets a value indicating whether the tooltip is visible.
///
- [Parameter]
public bool Visible { get; set; }
+
+ ///
+ /// Gets or sets a collection of additional attributes that will be applied to the created element.
+ ///
+ public virtual IReadOnlyDictionary? AdditionalAttributes { get; set; }
}
diff --git a/src/Core/Components/Tooltip/Services/TooltipService.cs b/src/Core/Components/Tooltip/Services/TooltipService.cs
index 5f22f87663..c26cf20554 100644
--- a/src/Core/Components/Tooltip/Services/TooltipService.cs
+++ b/src/Core/Components/Tooltip/Services/TooltipService.cs
@@ -1,3 +1,7 @@
+// ------------------------------------------------------------------------
+// MIT License - Copyright (c) Microsoft Corporation. All rights reserved.
+// ------------------------------------------------------------------------
+
namespace Microsoft.FluentUI.AspNetCore.Components.Components.Tooltip;
///
@@ -44,7 +48,7 @@ public IEnumerable Tooltips
}
///
- private IList TooltipList { get; } = new List();
+ private List TooltipList { get; } = [];
///
private ReaderWriterLockSlim TooltipLock { get; } = new ReaderWriterLockSlim();