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

66 lines
1.8 KiB

// Copyright (c) MudBlazor 2021
// MudBlazor licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using Connected.Annotations;
using Connected.Extensions;
using Connected.Utilities;
using Microsoft.AspNetCore.Components;
namespace Connected.Components;
public partial class Stack : UIComponent
{
protected string Classname =>
new CssBuilder("d-flex")
.AddClass($"flex-{(Row ? "row" : "column")}{(Reverse ? "-reverse" : string.Empty)}")
.AddClass($"justify-{Justify?.ToDescriptionString()}", Justify != null)
.AddClass($"align-{AlignItems?.ToDescriptionString()}", AlignItems != null)
.AddClass($"gap-{Spacing}")
.AddClass(Class)
.Build();
/// <summary>
/// If true, items will be placed horizontally in a row instead of vertically.
/// </summary>
[Parameter]
[Category(CategoryTypes.Stack.Behavior)]
public bool Row { get; set; }
/// <summary>
/// Reverses the order of its items.
/// </summary>
[Parameter]
[Category(CategoryTypes.Stack.Behavior)]
public bool Reverse { get; set; }
/// <summary>
/// Defines the spacing between its items.
/// </summary>
[Parameter]
[Category(CategoryTypes.Stack.Behavior)]
public int Spacing { get; set; } = 3;
/// <summary>
/// Defines the spacing between its items.
/// </summary>
[Parameter]
[Category(CategoryTypes.Stack.Behavior)]
public Justify? Justify { get; set; }
/// <summary>
/// Defines the spacing between its items.
/// </summary>
[Parameter]
[Category(CategoryTypes.Stack.Behavior)]
public AlignItems? AlignItems { get; set; }
/// <summary>
/// Child content of the component.
/// </summary>
[Parameter]
[Category(CategoryTypes.Stack.Behavior)]
public RenderFragment ChildContent { get; set; }
}