@if (!Label.IsEmpty())
{
-
+
@if (!SubLabel.IsEmpty())
{
- @(SubLabel))
+ @SubLabel
}
- } else
+ }
+ else
{
@ChildContent
}
@@ -20,28 +21,28 @@
/// The class for the group label. This will override any default classes.
///
[Parameter]
- public string Class { get; set; }
+ public string? Class { get; set; }
///
/// The label text.
///
[Parameter]
- public string Label { get; set; }
+ public string? Label { get; set; }
///
/// The sub label text, goes underneath the main label.
///
[Parameter]
- public string SubLabel { get; set; }
+ public string? SubLabel { get; set; }
[Parameter]
- public RenderFragment ChildContent { get; set; }
+ public RenderFragment? ChildContent { get; set; }
///
/// The class for the sub label. This will override any default classes.
///
[Parameter]
- public string SubLabelClass { get; set; }
+ public string? SubLabelClass { get; set; }
#endregion
#region private function(s)
@@ -49,12 +50,12 @@
/// Returns the default classes, if Class is not empty then return the custom classes.
///
///
a string of classes
- string ReturnClass() => Class.IsEmpty() ? "text-base font-medium text-gray-900" : Class;
+ string ReturnClass() => Class.IsEmpty() ? "text-base font-medium text-gray-900" : Class!;
///
/// Returns the default classes, if SubLabelClass is not empty then return the custom classes.
///
///
a string of classes
- string ReturnSubLabelClass() => SubLabelClass.IsEmpty() ? "text-sm text-gray-500" : SubLabelClass;
+ string ReturnSubLabelClass() => SubLabelClass.IsEmpty() ? "text-sm text-gray-500" : SubLabelClass!;
#endregion
}
diff --git a/src/TailBlazor.RadioButton/RadioButtonOrientation.cs b/src/TailBlazor.RadioButton/RadioButtonOrientation.cs
index b48930a..68a572c 100644
--- a/src/TailBlazor.RadioButton/RadioButtonOrientation.cs
+++ b/src/TailBlazor.RadioButton/RadioButtonOrientation.cs
@@ -1,22 +1,22 @@
-using System;
+using System;
-namespace TailBlazor.RadioButton
+namespace TailBlazor.RadioButton;
+
+public enum RadioButtonOrientation
{
- public enum RadioButtonOrientation
- {
- [Class("flex flex-col")]
- Vertical,
- [Class("flex flex-row")]
- Horizontal
- }
+ [Class("flex flex-col")]
+ Vertical,
+ [Class("flex flex-row")]
+ Horizontal
+}
- public class ClassAttribute : Attribute
+[AttributeUsage(AttributeTargets.Field)]
+public sealed class ClassAttribute : Attribute
+{
+ public ClassAttribute(string value)
{
- public string Value { get; set; }
-
- public ClassAttribute(string value)
- {
- this.Value = value;
- }
+ Value = value;
}
+
+ public string Value { get; }
}
diff --git a/src/TailBlazor.RadioButton/RadioItem.cs b/src/TailBlazor.RadioButton/RadioItem.cs
index 27a1b53..d20cd8e 100644
--- a/src/TailBlazor.RadioButton/RadioItem.cs
+++ b/src/TailBlazor.RadioButton/RadioItem.cs
@@ -1,13 +1,14 @@
-namespace TailBlazor.RadioButton
+namespace TailBlazor.RadioButton;
+
+///
+/// A model that will hold details for the radio inputs, in case the user wants to use a list.
+///
+///
the type for the Value param
+public class RadioItem
{
- ///
- /// A model that will hold details for the radio inputs, incase the user wants to use a list.
- ///
- /// the type for the Value param
- public class RadioItem
- {
- public string Id { get; set; }
- public string Text { get; set; }
- public TValue Value { get; set; }
- }
+ public string? Id { get; set; }
+
+ public string? Text { get; set; }
+
+ public required TValue Value { get; set; }
}
diff --git a/src/TailBlazor.RadioButton/TailBlazor.RadioButton.csproj b/src/TailBlazor.RadioButton/TailBlazor.RadioButton.csproj
index d5e38c1..75afc83 100644
--- a/src/TailBlazor.RadioButton/TailBlazor.RadioButton.csproj
+++ b/src/TailBlazor.RadioButton/TailBlazor.RadioButton.csproj
@@ -1,9 +1,9 @@
-
+
- net5.0
+ net9.0;net9.0-browser
TailBlazor.RadioButton
TailBlazor.RadioButton
- 1.0.1
+ 1.1.0
Rogerio Ribeiro
true
Blazor; TailBlazorcss; TailBlazor css; tailwind; tailwindcss; RadioButton; radio; Radio; Radio Button;
@@ -17,14 +17,12 @@
true
true
logo.png
+ enable
+ enable
-
-
-
-
-
+
diff --git a/src/TailBlazor.RadioButton/_Imports.razor b/src/TailBlazor.RadioButton/_Imports.razor
index 7728512..e6ba56e 100644
--- a/src/TailBlazor.RadioButton/_Imports.razor
+++ b/src/TailBlazor.RadioButton/_Imports.razor
@@ -1 +1,4 @@
-@using Microsoft.AspNetCore.Components.Web
+@using System.Collections.Generic
+@using System.Linq
+@using Microsoft.AspNetCore.Components
+@using Microsoft.AspNetCore.Components.Web