Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@
<BootstrapInput @bind-Value="@Model.Name" />
</div>
<div class="col-12 col-sm-6">
<CheckboxList @bind-Value="@SelectedItems" IsButton="true" Items="FooItems" />
<CheckboxList @bind-Value="@SelectedItems" IsButton="true" Items="FooItems" ShowLabel="true" DisplayText="Hobby" />
</div>
</div>
</ValidateForm>
Expand Down
3 changes: 2 additions & 1 deletion src/BootstrapBlazor/Components/Checkbox/CheckboxList.razor
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
<div class="@ButtonGroupClassString" role="group">
@foreach (var item in Items)
{
<DynamicElement TagName="span" TriggerClick="!IsDisabled" OnClick="() => OnClick(item)" class="@GetButtonItemClassString(item)">
<DynamicElement TagName="span" TriggerClick="!IsDisabled" OnClick="() => OnClick(item)"
class="@GetButtonItemClassString(item)">
@item.Text
</DynamicElement>
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ public partial class CheckboxList<TValue> : ValidateBase<TValue>
.Build();

private string? GetButtonItemClassString(SelectedItem item) => CssBuilder.Default("btn")
.AddClass($"active bg-{Color.ToDescriptionString()}", CurrentValueAsString.Split(',', StringSplitOptions.RemoveEmptyEntries).Contains(item.Value))
.AddClass($"btn-outline-{Color.ToDescriptionString()}")
.AddClass($"active", CurrentValueAsString.Split(',', StringSplitOptions.RemoveEmptyEntries).Contains(item.Value))
.Build();

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.checkbox-list {
.checkbox-list {
--bb-checkbox-item-width: #{$bb-checkbox-item-width};
min-height: var(--bb-height);
height: auto;
Expand Down Expand Up @@ -38,7 +38,6 @@
}

.btn-group {
border: var(--bs-border-width) solid var(--bs-border-color);
display: inline-flex;
flex: 0 !important;
flex-wrap: nowrap;
Expand All @@ -54,13 +53,19 @@

&.disabled {
> span {
--bs-btn-hover-color: var(--bs-btn-color);
--bs-btn-active-color: var(--bs-btn-color);
opacity: var(--bs-btn-disabled-opacity);

&:not(.active) {
background-color: var(--bs-secondary-bg);
}
}
}

.btn-outline-info {
--bs-btn-active-color: #fff;
}
}
}

Expand Down
Loading