diff --git a/src/Rhythm.Drop.Builders/Links/IHtmlAttributesLinkBuilder.cs b/src/Rhythm.Drop.Builders/Links/IHtmlAttributesLinkBuilder.cs
new file mode 100644
index 0000000..253393c
--- /dev/null
+++ b/src/Rhythm.Drop.Builders/Links/IHtmlAttributesLinkBuilder.cs
@@ -0,0 +1,25 @@
+namespace Rhythm.Drop.Builders.Links;
+
+using Rhythm.Drop.Models.Common.Attributes;
+
+///
+/// A contract for creating a link builder which modifies attributes.
+///
+/// The type of the builder to return after modifying HTML attributes.
+public interface IHtmlAttributesLinkBuilder
+{
+ ///
+ /// Adds an attribute to the current builder.
+ ///
+ /// The name of the attribute.
+ /// The value of the attribute.
+ /// A .
+ TBuilder IncludeAttribute(string name, object? value);
+
+ ///
+ /// Removes an attribute from the current builder.
+ ///
+ /// The name of the attribute.
+ /// A .
+ TBuilder ExcludeAttribute(string name);
+}
\ No newline at end of file
diff --git a/src/Rhythm.Drop.Builders/Links/IHtmlClassesLinkBuilder.cs b/src/Rhythm.Drop.Builders/Links/IHtmlClassesLinkBuilder.cs
new file mode 100644
index 0000000..cb255fc
--- /dev/null
+++ b/src/Rhythm.Drop.Builders/Links/IHtmlClassesLinkBuilder.cs
@@ -0,0 +1,22 @@
+namespace Rhythm.Drop.Builders.Links;
+
+///
+/// A contract for creating a link builder which modifies HTML classes.
+///
+/// The type of the builder to return after modifying HTML classes.
+public interface IHtmlClassesLinkBuilder
+{
+ ///
+ /// Adds a class to the current builder.
+ ///
+ /// The class name to add.
+ /// A .
+ TBuilder AddClass(string className);
+
+ ///
+ /// Adds a class to the current builder.
+ ///
+ /// The class name to remove.
+ /// A .
+ TBuilder RemoveClass(string className);
+}
\ No newline at end of file
diff --git a/src/Rhythm.Drop.Builders/Links/Modals/IModalAndLabelLinkBuilder.cs b/src/Rhythm.Drop.Builders/Links/Modals/IModalAndLabelLinkBuilder.cs
index 2cff8d1..a2aced0 100644
--- a/src/Rhythm.Drop.Builders/Links/Modals/IModalAndLabelLinkBuilder.cs
+++ b/src/Rhythm.Drop.Builders/Links/Modals/IModalAndLabelLinkBuilder.cs
@@ -6,7 +6,7 @@
///
/// A contract for creating a link builder with modal and a label.
///
-public interface IModalAndLabelLinkBuilder
+public interface IModalAndLabelLinkBuilder : IHtmlAttributesLinkBuilder, IHtmlClassesLinkBuilder
{
///
/// Gets the label of the link builder.
@@ -18,35 +18,6 @@ public interface IModalAndLabelLinkBuilder
///
IModal Modal { get; }
- ///
- /// Adds an attribute to the current builder.
- ///
- /// The name of the attribute.
- /// The value of the attribute.
- /// A .
- IModalAndLabelLinkBuilder IncludeAttribute(string name, object? value);
-
- ///
- /// Removes an attribute from the current builder.
- ///
- /// The name of the attribute.
- /// A .
- IModalAndLabelLinkBuilder ExcludeAttribute(string name);
-
- ///
- /// Adds a class to the current builder.
- ///
- /// The class name to add.
- /// A .
- IModalAndLabelLinkBuilder AddClass(string className);
-
- ///
- /// Adds a class to the current builder.
- ///
- /// The class name to remove.
- /// A .
- IModalAndLabelLinkBuilder RemoveClass(string className);
-
///
/// Attempts to build a based on the current input.
///
diff --git a/src/Rhythm.Drop.Builders/Links/Modals/ModalLinkBuilder.cs b/src/Rhythm.Drop.Builders/Links/Modals/ModalLinkBuilder.cs
index 8d1150a..cb0df6c 100644
--- a/src/Rhythm.Drop.Builders/Links/Modals/ModalLinkBuilder.cs
+++ b/src/Rhythm.Drop.Builders/Links/Modals/ModalLinkBuilder.cs
@@ -18,9 +18,6 @@ internal sealed class ModalLinkBuilder(IModal modal) : IModalLinkBuilder, IModal
///
public IModal Modal => modal;
- ///
- public IReadOnlyHtmlAttributeCollection Attributes => _attributes.ToReadOnly();
-
///
public string? Label { get; private set; }
diff --git a/src/Rhythm.Drop.Builders/Links/Url/IUrlAndLabelLinkBuilder.cs b/src/Rhythm.Drop.Builders/Links/Url/IUrlAndLabelLinkBuilder.cs
index 83d0662..16d73b0 100644
--- a/src/Rhythm.Drop.Builders/Links/Url/IUrlAndLabelLinkBuilder.cs
+++ b/src/Rhythm.Drop.Builders/Links/Url/IUrlAndLabelLinkBuilder.cs
@@ -1,13 +1,12 @@
namespace Rhythm.Drop.Builders.Links.Url;
using Rhythm.Drop.Builders.Links;
-using Rhythm.Drop.Models.Common.Attributes;
using Rhythm.Drop.Models.Links;
///
/// A contract for creating a with a URL and label.
///
-public interface IUrlAndLabelLinkBuilder
+public interface IUrlAndLabelLinkBuilder : IHtmlAttributesLinkBuilder, IHtmlClassesLinkBuilder
{
///
/// Gets the URL of the link builder.
@@ -19,43 +18,9 @@ public interface IUrlAndLabelLinkBuilder
///
string? Label { get; }
- ///
- /// Gets the attributes of the link builder.
- ///
- IReadOnlyHtmlAttributeCollection Attributes { get; }
-
///
/// Attempts to build a with a URL and label.
///
/// A if the input is valid.
ILink? Build();
-
- ///
- /// Adds an attribute to the current builder.
- ///
- /// The name of the attribute.
- /// The value of the attribute.
- /// A .
- IUrlAndLabelLinkBuilder IncludeAttribute(string name, object? value);
-
- ///
- /// Removes an attribute from the current builder.
- ///
- /// The name of the attribute.
- /// A .
- IUrlAndLabelLinkBuilder ExcludeAttribute(string name);
-
- ///
- /// Adds a class to the current builder.
- ///
- /// The class name to add.
- /// A .
- IUrlAndLabelLinkBuilder AddClass(string className);
-
- ///
- /// Adds a class to the current builder.
- ///
- /// The class name to remove.
- /// A .
- IUrlAndLabelLinkBuilder RemoveClass(string className);
}
\ No newline at end of file
diff --git a/src/Rhythm.Drop.Builders/Links/Url/UrlLinkBuilder.cs b/src/Rhythm.Drop.Builders/Links/Url/UrlLinkBuilder.cs
index 40f3c90..6341082 100644
--- a/src/Rhythm.Drop.Builders/Links/Url/UrlLinkBuilder.cs
+++ b/src/Rhythm.Drop.Builders/Links/Url/UrlLinkBuilder.cs
@@ -2,6 +2,7 @@
using Rhythm.Drop.Models.Common.Attributes;
using Rhythm.Drop.Models.Links;
+
///
/// An implementation of .
///
@@ -19,9 +20,6 @@ internal sealed class UrlLinkBuilder(string? url) : IUrlLinkBuilder, IUrlAndLabe
///
public string? Label { get; private set; }
- ///
- public IReadOnlyHtmlAttributeCollection Attributes => _attributes.ToReadOnly();
-
///
public IUrlAndLabelLinkBuilder AndLabel(string? label)
{
@@ -39,7 +37,7 @@ public IUrlAndLabelLinkBuilder AndLabel(string? label)
_attributes.SetAttribute("href", Url);
- return new AnchorLink(Label, Attributes);
+ return new AnchorLink(Label, _attributes.ToReadOnly());
}
///