Skip to content

Commit 11b0a9b

Browse files
committed
feat: 增加 HeaderPaddingY 参数调整 header y 轴间隙
1 parent a7d575b commit 11b0a9b

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

src/BootstrapBlazor/Components/Card/Card.razor

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
@inherits BootstrapModuleComponentBase
33
@attribute [BootstrapModuleAutoLoader(JSObjectReference = true)]
44

5-
<div @attributes="@AdditionalAttributes" class="@ClassString" id="@Id">
5+
<div @attributes="@AdditionalAttributes" id="@Id" class="@ClassString" style="@HeaderStyleString">
66
@if (HeaderTemplate != null || !string.IsNullOrEmpty(HeaderText))
77
{
88
<div class="card-header">

src/BootstrapBlazor/Components/Card/Card.razor.cs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,13 @@ public partial class Card
4949
.AddClass("text-muted", IsCenter)
5050
.Build();
5151

52+
/// <summary>
53+
/// 获得/设置 Card Header 高度 padding Y轴值 默认 null
54+
/// <para>单位需自行给定 如 0.25rem</para>
55+
/// </summary>
56+
[Parameter]
57+
public string? HeaderPaddingY { get; set; }
58+
5259
/// <summary>
5360
/// 获得/设置 收缩展开箭头图标 默认 fa-solid fa-circle-chevron-right
5461
/// </summary>
@@ -119,6 +126,10 @@ public partial class Card
119126
[NotNull]
120127
private IIconTheme? IconTheme { get; set; }
121128

129+
private string? HeaderStyleString => CssBuilder.Default()
130+
.AddStyle("--bs-card-cap-padding-y", HeaderPaddingY)
131+
.Build();
132+
122133
/// <summary>
123134
/// <inheritdoc/>
124135
/// </summary>

0 commit comments

Comments
 (0)