dotnet/aspnetcore

Pass css class in `<ValidationSummary />` to the generated `<ul>`

已关闭

#43,860 创建于 2022年9月9日

 (5 条评论) (0 个反应) (0 位负责人)C# (10,653 个派生)batch import
area-blazorenhancementfeature-blazor-builtin-componentsgood first issuehelp wanted

仓库指标

星标
 (37,933 个星标)
PR 合并指标
 (平均合并 16天 9小时) (30 天内合并 258 个 PR)

描述

Is there an existing issue for this?

  • I have searched the existing issues

Is your feature request related to a problem? Please describe the problem.

I am trying to pass additional css classes to the generated ul element. I am applying general formatting via the validation-errors css class, but I would like to be able to pass utility classes for spacing (i.e. pt-2 to add 8px of padding to the top of the validation summary).

Describe the solution you'd like

Update <ValidationSummary /> to pass unmatched attributes (via splatting) to the validation-errors element. In the case of class, it should append the passed in classes to the existing validation-errors class.

Additional context

For example:

<ValidationSummary class="pt-2" data-test="validation-errors" />

should result in:

<ul class="validation-errors pt-2"  data-test="validation-errors">
    <!-- Validation Errors -->
</ul>

贡献者指南