diff --git a/src/BootstrapBlazor.Server/Components/Samples/EditorForms.razor b/src/BootstrapBlazor.Server/Components/Samples/EditorForms.razor
index 7585671c5a6..3e3169ae42e 100644
--- a/src/BootstrapBlazor.Server/Components/Samples/EditorForms.razor
+++ b/src/BootstrapBlazor.Server/Components/Samples/EditorForms.razor
@@ -21,12 +21,12 @@
-
-
-
+
+
+
-
+
@@ -41,11 +41,11 @@
-
-
+
+
-
+
@@ -57,8 +57,8 @@
@((MarkupString)Localizer["AutoGenerateDescription"].Value)
-
-
+
+
@@ -70,22 +70,22 @@
-
-
+
+
-
+
-
+
-
+
-
+
@@ -98,10 +98,10 @@
-
+
-
+
@@ -119,11 +119,11 @@
-
+
-
+
@@ -132,4 +132,4 @@
-
+
diff --git a/src/BootstrapBlazor/Components/Label/BootstrapLabel.razor b/src/BootstrapBlazor/Components/Label/BootstrapLabel.razor
index a8a0bf750d7..e2cc22ec2e0 100644
--- a/src/BootstrapBlazor/Components/Label/BootstrapLabel.razor
+++ b/src/BootstrapBlazor/Components/Label/BootstrapLabel.razor
@@ -14,5 +14,5 @@ else
@code {
RenderFragment RenderLabel =>
- @;
+ @;
}
diff --git a/src/BootstrapBlazor/Components/Label/BootstrapLabel.razor.cs b/src/BootstrapBlazor/Components/Label/BootstrapLabel.razor.cs
index 60363472b15..9de80e6afd4 100644
--- a/src/BootstrapBlazor/Components/Label/BootstrapLabel.razor.cs
+++ b/src/BootstrapBlazor/Components/Label/BootstrapLabel.razor.cs
@@ -23,12 +23,22 @@ public partial class BootstrapLabel
[Parameter]
public bool? ShowLabelTooltip { get; set; }
+ ///
+ /// 获得/设置 标签宽度 默认 null 未设置使用全局设置 --bb-row-label-width 值
+ ///
+ [Parameter]
+ public int? LabelWidth { get; set; }
+
private bool _showTooltip;
private string? ClassString => CssBuilder.Default("form-label")
.AddClassFromAttributes(AdditionalAttributes)
.Build();
+ private string? StyleString => CssBuilder.Default()
+ .AddClass($"--bb-row-label-width: {LabelWidth}px;", LabelWidth.HasValue)
+ .Build();
+
///
///
///
diff --git a/test/UnitTest/Components/TextareaTest.cs b/test/UnitTest/Components/TextareaTest.cs
index 99bde4a2d31..63a60b918df 100644
--- a/test/UnitTest/Components/TextareaTest.cs
+++ b/test/UnitTest/Components/TextareaTest.cs
@@ -14,6 +14,12 @@ public void IsShowLabel_OK()
var component = cut.FindComponent();
Assert.NotNull(component);
+
+ component.SetParametersAndRender(pb =>
+ {
+ pb.Add(a => a.LabelWidth, 120);
+ });
+ cut.Contains("style=\"--bb-row-label-width: 120px;\"");
}
[Fact]