From abc12d8d68bdfff73f9afa95220a2f375a400e9d Mon Sep 17 00:00:00 2001 From: Luke Latham <1622880+guardrex@users.noreply.github.com> Date: Fri, 9 Jul 2021 06:22:07 -0500 Subject: [PATCH 1/3] Required Blazor parameters --- aspnetcore/blazor/components/index.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/aspnetcore/blazor/components/index.md b/aspnetcore/blazor/components/index.md index 8de35bf1981c..44207896c1f7 100644 --- a/aspnetcore/blazor/components/index.md +++ b/aspnetcore/blazor/components/index.md @@ -513,6 +513,18 @@ public DateTime StartData { get; set; } = DateTime.Now; After the initial assignment of , do **not** assign a value to `StartData` in developer code. For more information, see the [Overwritten parameters](#overwritten-parameters) section of this article. +::: moniker range=">= aspnetcore-6.0" + +Apply the `[EditorRequired]` attribute to specify a required component parameter. If a parameter value isn't provided, editors or build tools may display warnings to the user. This attribute is only valid on properties also marked with the `[Parameter]` attribute. + +```csharp +[Parameter] +[EditorRequired] +public string Title { get; set; } +``` + +::: moniker-end + ## Route parameters Components can specify route parameters in the route template of the [`@page`][9] directive. The [Blazor router](xref:blazor/fundamentals/routing) uses route parameters to populate corresponding component parameters. From e3d753373b7bf2ebfe9fcae4f686672f4784c1b7 Mon Sep 17 00:00:00 2001 From: Luke Latham <1622880+guardrex@users.noreply.github.com> Date: Fri, 9 Jul 2021 14:43:44 -0500 Subject: [PATCH 2/3] Updates --- aspnetcore/blazor/components/index.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/aspnetcore/blazor/components/index.md b/aspnetcore/blazor/components/index.md index 44207896c1f7..4886aea5e680 100644 --- a/aspnetcore/blazor/components/index.md +++ b/aspnetcore/blazor/components/index.md @@ -523,6 +523,13 @@ Apply the `[EditorRequired]` attribute to specify a required component parameter public string Title { get; set; } ``` +Single-line attribute lists are also supported: + +```csharp +[Parameter, EditorRequired] +public string Title { get; set; } +``` + ::: moniker-end ## Route parameters From fab52330e489653730c7f4605c6012a551ec8f1f Mon Sep 17 00:00:00 2001 From: Luke Latham <1622880+guardrex@users.noreply.github.com> Date: Thu, 15 Jul 2021 05:09:13 -0500 Subject: [PATCH 3/3] Updates --- aspnetcore/blazor/components/index.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/aspnetcore/blazor/components/index.md b/aspnetcore/blazor/components/index.md index 4886aea5e680..9c36ce20c4b9 100644 --- a/aspnetcore/blazor/components/index.md +++ b/aspnetcore/blazor/components/index.md @@ -515,7 +515,7 @@ After the initial assignment of