You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Connected.Components/Components/ButtonGroup/ButtonGroup.razor.cs

76 lines
2.4 KiB

2 years ago
using Connected.Annotations;
using Connected.Extensions;
using Connected.Utilities;
using Microsoft.AspNetCore.Components;
namespace Connected.Components;
public partial class ButtonGroup : UIComponent
{
protected string Classname =>
new CssBuilder("mud-button-group-root")
.AddClass($"mud-button-group-override-styles", OverrideStyles)
.AddClass($"mud-button-group-{Variant.ToDescriptionString()}")
.AddClass($"mud-button-group-{Variant.ToDescriptionString()}-{Color.ToDescriptionString()}")
.AddClass($"mud-button-group-{Variant.ToDescriptionString()}-size-{Size.ToDescriptionString()}")
.AddClass($"mud-button-group-vertical", VerticalAlign)
.AddClass($"mud-button-group-horizontal", !VerticalAlign)
.AddClass($"mud-button-group-disable-elevation", DisableElevation)
.AddClass($"mud-button-group-rtl", RightToLeft)
.AddClass(Class)
.Build();
[CascadingParameter(Name = "RightToLeft")]
public bool RightToLeft { get; set; }
/// <summary>
/// If true, the button group will override the styles of the individual buttons.
/// </summary>
[Parameter]
[Category(CategoryTypes.ButtonGroup.Appearance)]
public bool OverrideStyles { get; set; } = true;
/// <summary>
/// Child content of component.
/// </summary>
[Parameter]
[Category(CategoryTypes.ButtonGroup.Behavior)]
public RenderFragment ChildContent { get; set; }
/// <summary>
/// If true, the button group will be displayed vertically.
/// </summary>
[Parameter]
[Category(CategoryTypes.ButtonGroup.Appearance)]
public bool VerticalAlign { get; set; } = false;
/// <summary>
/// If true, no drop-shadow will be used.
/// </summary>
[Parameter]
[Category(CategoryTypes.ButtonGroup.Appearance)]
public bool DisableElevation { get; set; } = false;
/// <summary>
/// The color of the component. It supports the theme colors.
/// </summary>
[Parameter]
[Category(CategoryTypes.ButtonGroup.Appearance)]
public ThemeColor Color { get; set; } = ThemeColor.Default;
/// <summary>
/// The size of the component.
/// </summary>
[Parameter]
[Category(CategoryTypes.ButtonGroup.Appearance)]
public Size Size { get; set; } = Size.Medium;
/// <summary>
/// The variant to use.
/// </summary>
[Parameter]
[Category(CategoryTypes.ButtonGroup.Appearance)]
public Variant Variant { get; set; } = Variant.Text;
}