Enterprise-level component library based on Bootstrap and Blazor

star nuget master download license repo commit

Row

The number of components displayed in a row can be easily set

Put your own components inside Row

Demo

3 rows are displayed, using Row

Card 1

Some quick example text to build on the card title and make up the bulk of the card's content.

Go somewhere
Card 2

Some quick example text to build on the card title and make up the bulk of the card's content.

Go somewhere
Card 3

Some quick example text to build on the card title and make up the bulk of the card's content.

Go somewhere
Card 1

Some quick example text to build on the card title and make up the bulk of the card's content.

Go somewhere
Card 2

Some quick example text to build on the card title and make up the bulk of the card's content.

Go somewhere
Card 3

Some quick example text to build on the card title and make up the bulk of the card's content.

Go somewhere

When placing form controls, you can specify RowType as Inline, and Label will be displayed on the left, and the control will fill the remaining space

Demo

In this example, the Row component is built into the ValidateForm component, and the front Label tag is automatically added

  •  
  • 0
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  •  
  • 0
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 51
  • 52
  • 53
  • 54
  • 55
  • 56
  • 57
  • 58
  • 59
  •  
  • 0
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 51
  • 52
  • 53
  • 54
  • 55
  • 56
  • 57
  • 58
  • 59
1997 December
SunMonTueWedThuFriSat
30
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
1
2
3
4
5
6
7
8
9
10
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
Jan
Feb
Mar
Apr
May
Jun
Jul
Aug
Sep
Oct
Nov
Dec

When placing form controls, you can specify Normal as FormRow, and Label will be displayed on the top, and the control will be full

Demo

In this example, the Row component is built into the ValidateForm component, and the front Label tag is automatically added

  •  
  • 0
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  •  
  • 0
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 51
  • 52
  • 53
  • 54
  • 55
  • 56
  • 57
  • 58
  • 59
  •  
  • 0
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 51
  • 52
  • 53
  • 54
  • 55
  • 56
  • 57
  • 58
  • 59
1997 December
SunMonTueWedThuFriSat
30
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
1
2
3
4
5
6
7
8
9
10
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
Jan
Feb
Mar
Apr
May
Jun
Jul
Aug
Sep
Oct
Nov
Dec

The Row component supports nested use. For example, the outermost Row below sets a row to display two controls, the first is TextBox, the second One is still Row, and the second Row continues to be set to display two controls

Demo

In this example, the Row component is built into the ValidateForm component, and the front Label tag is automatically added

<Row ItemsPerRow="ItemsPerRow.Two">
    <BootstrapInput @bind-Value="@Model.Name" />
    <Row ItemsPerRow="ItemsPerRow.Two">
        <Switch @bind-Value="@Model.Complete" />
        <BootstrapInput @bind-Value="@Model.Address" />
    </Row>
</Row>

The Row component can set the number of spanning columns by specifying the ColSpan value. Combining these functions can achieve complex layouts

Demo

In this example, the Row component is built into the ValidateForm component, and the front Label tag is automatically added

4 in a row

<Row ItemsPerRow="ItemsPerRow.Four">
    <BootstrapInput @bind-Value="@Model.Name" />
    <BootstrapInput @bind-Value="@Model.Address" />
    <BootstrapInputNumber @bind-Value="@Model.Count" />
    <Select @bind-Value="@Model.Education" />
</Row>

2 in a row

<Row ItemsPerRow="ItemsPerRow.Two"
    <BootstrapInput @bind-Value="@Model.Name" />
    <BootstrapInput @bind-Value="@Model.Address" />
</Row>

The row shows 4 Address in 2 columns

<Row ItemsPerRow="ItemsPerRow.Four">
    <BootstrapInput @bind-Value="@Model.Name" />
    <Row ColSpan="2">
        <BootstrapInput @bind-Value="@Model.Address" />
    </Row>
    <Select @bind-Value="@Model.Education" />
</Row>

Row shows 4, the second component ColSpan is set to 3

<Row ItemsPerRow="ItemsPerRow.Four">
    <BootstrapInput @bind-Value="@Model.Name" />
    <Row ColSpan="3">
        <BootstrapInput @bind-Value="@Model.Address" />
    </Row>
</Row>

Row shows 2, the first component ColSpan is set to 3

<Row ItemsPerRow="ItemsPerRow.Four">
    <Row ColSpan="3">
        <CheckboxList @bind-Value="@Model.Hobby" Items="@Hobbys" />
    </Row>
    <BootstrapInput @bind-Value="@Model.Address" />
</Row>

A component in a row

Attributes

Loading...
@page "/rows"
@inject IStringLocalizer<Rows> RowsLocalizer

<h3>@RowsLocalizer["Title"]</h3>

<h4>@RowsLocalizer["H1"]</h4>

<Block Title="@RowsLocalizer["Block1Title"]" Introduction="@RowsLocalizer["Block1Intro"]">
    <p><b>@((MarkupString)RowsLocalizer["b1"].Value)</b></p>
    <Row ItemsPerRow="ItemsPerRow.Three">
        <Card>
            <CardBody>
                <h5 class="card-title">Card 1</h5>
                <p class="card-text">Some quick example text to build on the card title and make up the bulk of the card's content.</p>
                <a href="#" class="btn btn-primary">Go somewhere</a>
            </CardBody>
        </Card>
        <Card>
            <CardBody>
                <h5 class="card-title">Card 2</h5>
                <p class="card-text">Some quick example text to build on the card title and make up the bulk of the card's content.</p>
                <a href="#" class="btn btn-primary">Go somewhere</a>
            </CardBody>
        </Card>
        <Card>
            <CardBody>
                <h5 class="card-title">Card 3</h5>
                <p class="card-text">Some quick example text to build on the card title and make up the bulk of the card's content.</p>
                <a href="#" class="btn btn-primary">Go somewhere</a>
            </CardBody>
        </Card>
        <Card>
            <CardBody>
                <h5 class="card-title">Card 1</h5>
                <p class="card-text">Some quick example text to build on the card title and make up the bulk of the card's content.</p>
                <a href="#" class="btn btn-primary">Go somewhere</a>
            </CardBody>
        </Card>
        <Card>
            <CardBody>
                <h5 class="card-title">Card 2</h5>
                <p class="card-text">Some quick example text to build on the card title and make up the bulk of the card's content.</p>
                <a href="#" class="btn btn-primary">Go somewhere</a>
            </CardBody>
        </Card>
        <Card>
            <CardBody>
                <h5 class="card-title">Card 3</h5>
                <p class="card-text">Some quick example text to build on the card title and make up the bulk of the card's content.</p>
                <a href="#" class="btn btn-primary">Go somewhere</a>
            </CardBody>
        </Card>
    </Row>
</Block>

<Block Title="@RowsLocalizer["Block2Title"]" Introduction="@RowsLocalizer["Block2Intro"]">
    <p>@((MarkupString)RowsLocalizer["P1"].Value)</p>
    <ValidateForm Model="@Model">
        <Row ItemsPerRow="ItemsPerRow.Two" RowType="RowType.Inline">
            <CheckboxList @bind-Value="@Model.Hobby" Items="Hobbys" />
            <BootstrapInput @bind-Value="@Model.Address" />
            <DateTimePicker @bind-Value="@Model.DateTime" />
            <BootstrapInputNumber @bind-Value="@Model.Count" />
            <Switch @bind-Value="@Model.Complete" />
            <Select @bind-Value="@Model.Education" />
        </Row>
    </ValidateForm>
</Block>

<Block Title="@RowsLocalizer["Block3Title"]" Introduction="@RowsLocalizer["Block3Intro"]">
    <p>@((MarkupString)RowsLocalizer["P1"].Value)</p>
    <ValidateForm Model="@Model">
        <Row ItemsPerRow="ItemsPerRow.Three">
            <CheckboxList @bind-Value="@Model.Hobby" Items="Hobbys" />
            <BootstrapInput @bind-Value="@Model.Address" />
            <DateTimePicker @bind-Value="@Model.DateTime" />
            <BootstrapInputNumber @bind-Value="@Model.Count" />
            <Switch @bind-Value="@Model.Complete" />
            <Select @bind-Value="@Model.Education" />
        </Row>
    </ValidateForm>
</Block>

<Block Title="@RowsLocalizer["Block4Title"]" Introduction="@RowsLocalizer["Block4Intro"]">
    <p>@((MarkupString)RowsLocalizer["P1"].Value)</p>
    <Pre>&lt;Row ItemsPerRow="ItemsPerRow.Two"&gt;
    &lt;BootstrapInput @@bind-Value="@@Model.Name" /&gt;
    &lt;Row ItemsPerRow="ItemsPerRow.Two"&gt;
        &lt;Switch @@bind-Value="@@Model.Complete" /&gt;
        &lt;BootstrapInput @@bind-Value="@@Model.Address" /&gt;
    &lt;/Row&gt;
&lt;/Row&gt;</Pre>
    <ValidateForm Model="@Model">
        <Row ItemsPerRow="ItemsPerRow.Two">
            <BootstrapInput @bind-Value="@Model.Name" />
            <Row ItemsPerRow="ItemsPerRow.Two">
                <Switch @bind-Value="@Model.Complete" />
                <BootstrapInput @bind-Value="@Model.Address" />
            </Row>
        </Row>
    </ValidateForm>
</Block>

<Block Title="@RowsLocalizer["Block5Title"]" Introduction="@RowsLocalizer["Block5Intro"]">
    <p>@((MarkupString)RowsLocalizer["P1"].Value)</p>

    <p><b>@RowsLocalizer["b2"]</b></p>
    <Pre>&lt;Row ItemsPerRow="ItemsPerRow.Four"&gt;
    &lt;BootstrapInput @@bind-Value="@@Model.Name" /&gt;
    &lt;BootstrapInput @@bind-Value="@@Model.Address" /&gt;
    &lt;BootstrapInputNumber @@bind-Value="@@Model.Count" /&gt;
    &lt;Select @@bind-Value="@@Model.Education" /&gt;
&lt;/Row&gt;</Pre>
    <ValidateForm Model="@Model">
        <Row ItemsPerRow="ItemsPerRow.Four">
            <BootstrapInput @bind-Value="@Model.Name" />
            <BootstrapInput @bind-Value="@Model.Address" />
            <BootstrapInputNumber @bind-Value="@Model.Count" />
            <Select @bind-Value="@Model.Education" />
        </Row>
    </ValidateForm>

    <p class="mt-3"><b>@RowsLocalizer["b3"]</b></p>
    <Pre>&lt;Row ItemsPerRow="ItemsPerRow.Two"
    &lt;BootstrapInput @@bind-Value="@@Model.Name" /&gt;
    &lt;BootstrapInput @@bind-Value="@@Model.Address" /&gt;
&lt;/Row&gt;</Pre>
    <ValidateForm Model="@Model">
        <Row ItemsPerRow="ItemsPerRow.Two">
            <BootstrapInput @bind-Value="@Model.Name" />
            <BootstrapInput @bind-Value="@Model.Address" />
        </Row>
    </ValidateForm>

    <p class="mt-3"><b>@((MarkupString)RowsLocalizer["b4"].Value)</b></p>
    <Pre>&lt;Row ItemsPerRow="ItemsPerRow.Four"&gt;
    &lt;BootstrapInput @@bind-Value="@@Model.Name" /&gt;
    &lt;Row ColSpan="2"&gt;
        &lt;BootstrapInput @@bind-Value="@@Model.Address" /&gt;
    &lt;/Row&gt;
    &lt;Select @@bind-Value="@@Model.Education" /&gt;
&lt;/Row&gt;</Pre>
    <ValidateForm Model="@Model">
        <Row ItemsPerRow="ItemsPerRow.Four">
            <BootstrapInput @bind-Value="@Model.Name" />
            <Row ColSpan="2">
                <BootstrapInput @bind-Value="@Model.Address" />
            </Row>
            <Select @bind-Value="@Model.Education" />
        </Row>
    </ValidateForm>

    <p class="mt-3"><b>@((MarkupString)RowsLocalizer["b5"].Value)</b></p>
    <Pre>&lt;Row ItemsPerRow="ItemsPerRow.Four"&gt;
    &lt;BootstrapInput @@bind-Value="@@Model.Name" /&gt;
    &lt;Row ColSpan="3"&gt;
        &lt;BootstrapInput @@bind-Value="@@Model.Address" /&gt;
    &lt;/Row&gt;
&lt;/Row&gt;</Pre>
    <ValidateForm Model="@Model">
        <Row ItemsPerRow="ItemsPerRow.Four">
            <BootstrapInput @bind-Value="@Model.Name" />
            <Row ColSpan="3">
                <BootstrapInput @bind-Value="@Model.Address" />
            </Row>
        </Row>
    </ValidateForm>

    <p class="mt-3"><b>@((MarkupString)RowsLocalizer["b6"].Value)</b></p>
    <Pre>&lt;Row ItemsPerRow="ItemsPerRow.Four"&gt;
    &lt;Row ColSpan="3"&gt;
        &lt;CheckboxList @@bind-Value="@@Model.Hobby" Items="@@Hobbys" /&gt;
    &lt;/Row&gt;
    &lt;BootstrapInput @@bind-Value="@@Model.Address" /&gt;
&lt;/Row&gt;</Pre>
    <ValidateForm Model="@Model">
        <Row ItemsPerRow="ItemsPerRow.Four">
            <Row ColSpan="3">
                <CheckboxList @bind-Value="@Model.Hobby" Items="@Hobbys" />
            </Row>
            <BootstrapInput @bind-Value="@Model.Address" />
        </Row>
    </ValidateForm>

    <p class="mt-3"><b>@RowsLocalizer["b7"]</b></p>
    <ValidateForm Model="@Model">
        <Row ItemsPerRow="ItemsPerRow.One">
            <BootstrapInput @bind-Value="@Model.Address" />
        </Row>
    </ValidateForm>
</Block>

<AttributeTable Items="@GetAttributes()" />
// Copyright (c) Argo Zhang (argo@163.com). All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
// Website: https://www.blazor.zone or https://argozhang.github.io/

using BootstrapBlazor.Components;
using BootstrapBlazor.Shared.Common;
using BootstrapBlazor.Shared.Pages.Components;
using Microsoft.AspNetCore.Components;
using Microsoft.Extensions.Localization;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Diagnostics.CodeAnalysis;

namespace BootstrapBlazor.Shared.Pages
{
    /// <summary>
    /// 
    /// </summary>
    public sealed partial class Rows
    {
        [Inject]
        [NotNull]
        private IStringLocalizer<Foo>? Localizer { get; set; }

        private RowFoo Model { get; } = new()
        {
            Name = "张三",
            Count = 23,
            Address = "测试地址",
            DateTime = new DateTime(1997, 12, 05),
            Educations = new List<EnumEducation> { EnumEducation.Primary, EnumEducation.Middel }
        };

        [NotNull]
        private IEnumerable<SelectedItem>? Hobbys { get; set; }

        /// <summary>
        /// OnInitialized 方法
        /// </summary>
        protected override void OnInitialized()
        {
            base.OnInitialized();

            Hobbys = Foo.GenerateHobbys(Localizer);
        }

        private IEnumerable<AttributeItem> GetAttributes() => new AttributeItem[]
        {
            new AttributeItem() {
                Name = "ItemsPerRow",
                Description = RowsLocalizer["Desc1"]!,
                Type = "enum",
                ValueList = " One,Two,Three,Four,Six,Twelve ",
                DefaultValue = " One "
            },
            new AttributeItem() {
                Name = "RowType",
                Description = RowsLocalizer["Desc2"]!,
                Type = "enum?",
                ValueList = "Normal, Inline",
                DefaultValue = "null"
            },
            new AttributeItem() {
                Name = "ColSpan",
                Description = RowsLocalizer["Desc3"]!,
                Type = "int?",
                ValueList = "-",
                DefaultValue = "null"
            },
            new AttributeItem() {
                Name = "MaxCount",
                Description = RowsLocalizer["Desc4"]!,
                Type = "int?",
                ValueList = "-",
                DefaultValue = "null"
            }
        };

        private class RowFoo : Foo
        {
            /// <summary>
            /// 
            /// </summary>
            [Required(ErrorMessage = "请选择学历")]
            [Display(Name = "学历")]
            [AutoGenerateColumn(Order = 60)]
            public List<EnumEducation>? Educations { get; set; }
        }
    }
}

B 站相关视频链接

暂无

交流群

QQ Group:BootstrapAdmin & Blazor 795206915( Full) 675147445 Welcome to join the group discussion
Themes
Bootstrap
Ant Design (完善中)
Bluma (完善中)
LayUI (完善中)
Motronic (已集成)
An error has occurred. This application may no longer respond until reloaded. Reload