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/Input/InputLabel.razor.cs

49 lines
1.4 KiB

2 years ago
using Connected.Extensions;
using Microsoft.AspNetCore.Components;
namespace Connected.Components;
public partial class InputLabel : UIComponent
{
protected string Classname =>
new Utilities.CssBuilder()
.AddClass("mud-input-label")
.AddClass("mud-input-label-animated")
.AddClass($"mud-input-label-{Variant.ToDescriptionString()}")
.AddClass($"mud-input-label-margin-{Margin.ToDescriptionString()}", when: () => Margin != Margin.None)
.AddClass($"mud-disabled", Disabled)
.AddClass("mud-input-error", Error)
.AddClass(Class)
.Build();
/// <summary>
/// Child content of component.
/// </summary>
[Parameter] public RenderFragment ChildContent { get; set; }
/// <summary>
/// If true, the input element will be disabled.
/// </summary>
[Parameter] public bool Disabled { get; set; }
/// <summary>
/// If true, the label will be displayed in an error state.
/// </summary>
[Parameter] public bool Error { get; set; }
/// <summary>
/// Variant to use.
/// </summary>
[Parameter] public Variant Variant { get; set; } = Variant.Text;
/// <summary>
/// Will adjust vertical spacing.
/// </summary>
[Parameter] public Margin Margin { get; set; } = Margin.None;
/// <summary>
/// Will set the for attribute for WCAG accessiblility
/// </summary>
[Parameter] public string ForId { get; set; } = string.Empty;
}